Amit Parik (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-bug-1021130-amp into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
Related bugs:
Bug #1021130 in OpenERP Addons: "[trunk] hr_payroll: Can not duplicate salary
structure"
https://bugs.launchpad.net/openobject-addons/+bug/1021130
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1021130-amp/+merge/113910
Hello,
Fixes the copy method problem on this branch.
Salary structure has a 'rule_ids" m2m field, but we have written a copy method
before adding this m2m field, that's why when we have duplicating "Salary
Structure" it gives a traceback.
This fix will solve this problem.
Thank you!
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1021130-amp/+merge/113910
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-bug-1021130-amp.
=== modified file 'hr_payroll/hr_payroll.py'
--- hr_payroll/hr_payroll.py 2012-06-20 13:04:49 +0000
+++ hr_payroll/hr_payroll.py 2012-07-09 06:57:21 +0000
@@ -68,25 +68,6 @@
'parent_id': _get_parent,
}
- def copy(self, cr, uid, id, default=None, context=None):
- """
- Create a new record in hr_payroll_structure model from existing one
- @param cr: cursor to database
- @param user: id of current user
- @param id: list of record ids on which copy method executes
- @param default: dict type contains the values to be override during copy of object
- @param context: context arguments, like lang, time zone
-
- @return: returns a id of newly created record
- """
- if not default:
- default = {}
- default.update({
- 'code': self.browse(cr, uid, id, context=context).code + "(copy)",
- 'company_id': self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
- })
- return super(hr_payroll_structure, self).copy(cr, uid, id, default, context=context)
-
def get_all_rules(self, cr, uid, structure_ids, context=None):
"""
@param structure_ids: list of structure
@@ -953,6 +934,25 @@
_columns = {
'rule_ids':fields.many2many('hr.salary.rule', 'hr_structure_salary_rule_rel', 'struct_id', 'rule_id', 'Salary Rules'),
}
+
+ def copy(self, cr, uid, id, default=None, context=None):
+ """
+ Create a new record in hr_payroll_structure model from existing one
+ @param cr: cursor to database
+ @param user: id of current user
+ @param id: list of record ids on which copy method executes
+ @param default: dict type contains the values to be override during copy of object
+ @param context: context arguments, like lang, time zone
+
+ @return: returns a id of newly created record
+ """
+ if not default:
+ default = {}
+ default.update({
+ 'code': self.browse(cr, uid, id, context=context).code + "(copy)",
+ 'company_id': self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
+ })
+ return super(hr_payroll_structure, self).copy(cr, uid, id, default, context=context)
hr_payroll_structure()
_______________________________________________
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