diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index fb0b692adaa..ad60042b782 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -976,9 +976,10 @@ class hr_payslip(osv.osv): value = line.amount else: value = line.amount -# elif line.amount_type == 'code': # Need some clarification so this option remains -# value = slip_line_pool.execute_function(cr, uid, line.id, amt, context) -# line.amount = value + elif line.amount_type=='code': + localdict = {'basic':amt} + exec line.python_code in localdict + value = localdict['result'] total += value vals = { 'category_id': line.category_id.id, @@ -1200,8 +1201,10 @@ class hr_salary_rule(osv.osv): 'sequence': fields.integer('Sequence', required=True, help='Use to arrange calculation sequence'), 'active':fields.boolean('Active'), 'python_code': fields.text('Python code'), + 'python_compute':fields.text('Python Code'), } _defaults = { + 'python_compute': '''# price_unit\n\nresult = basic * 0.10''', 'conditions': 'True', 'computational_expression': 'basic', 'sequence': 5, diff --git a/addons/hr_payroll/hr_payroll_view.xml b/addons/hr_payroll/hr_payroll_view.xml index bfc6593d6bc..5a5c1b5b061 100644 --- a/addons/hr_payroll/hr_payroll_view.xml +++ b/addons/hr_payroll/hr_payroll_view.xml @@ -81,9 +81,9 @@ - - - + + + @@ -599,33 +599,35 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + +