Amit Parik (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-988165-amp into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #988165 in OpenERP Addons: "[hr] when copy a department all employees 
assigned get duplicated"
  https://bugs.launchpad.net/openobject-addons/+bug/988165

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-988165-amp/+merge/103417

Override a copy method on department object because it's created a problem when 
we have duplicate  the department then it's also duplicated the employee of 
deportment due to member_ids one2many field on hr.department object.

In this Fix, I have override the copy method and set member_ids as a blank 
blank.

Thank you!
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-988165-amp/+merge/103417
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-988165-amp.
=== modified file 'hr/hr.py'
--- hr/hr.py	2012-08-10 14:43:39 +0000
+++ hr/hr.py	2012-08-27 13:21:25 +0000
@@ -289,7 +289,14 @@
         'manager_id': fields.many2one('hr.employee', 'Manager'),
         'member_ids': fields.one2many('hr.employee', 'department_id', 'Members', readonly=True),
     }
-
+    
+    def copy(self, cr, uid, ids, default=None, context=None):
+        if default is None:
+            default = {}
+        default = default.copy()
+        default.update({'member_ids': []})
+        return super(hr_department, self).copy(cr, uid, id, default, context=context)
+    
 hr_department()
 
 

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to