# HG changeset patch
# Parent 7d14b75cdfd4c7a272a13572947de5d47f3e851f

Index: addons/openacademy/models.py
===================================================================
--- addons.orig/openacademy/models.py	2014-08-28 11:00:44.343194847 +0200
+++ addons/openacademy/models.py	2014-08-28 13:44:32.143048955 +0200
@@ -13,6 +13,20 @@
     session_ids = fields.One2many(
         'openacademy.session', 'course_id', string="Sessions")
 
+    @api.one
+    def copy(self, default=None):
+        default = dict(default or {})
+
+        copied_count = self.search_count(
+            [('name', '=like', u"Copy of {}%".format(self.name))])
+        if not copied_count:
+            new_name = u"Copy of {}".format(self.name)
+        else:
+            new_name = u"Copy of {} ({})".format(self.name, copied_count)
+
+        default['name'] = new_name
+        return super(Course, self).copy(default)
+
     _sql_constraints = [
         ('name_description_check',
          'CHECK(name != description)',
