diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py
index c4dcec2f8bb..2c8f957aa03 100644
--- a/addons/hr_payroll/hr_payroll.py
+++ b/addons/hr_payroll/hr_payroll.py
@@ -473,7 +473,7 @@ class hr_payslip(osv.osv):
res += [attendances] + leaves
return res
- def get_input_lines(self, cr, uid, contract_ids, date_from, date_to, context=None):
+ def get_inputs(self, cr, uid, contract_ids, date_from, date_to, context=None):
res = []
contract_obj = self.pool.get('hr.contract')
rule_obj = self.pool.get('hr.salary.rule')
@@ -488,7 +488,6 @@ class hr_payslip(osv.osv):
for input in rule.input_ids:
inputs = {
'name': input.name,
- 'sequence': 5,
'code': input.code,
'contract_id': contract.id,
}
@@ -510,10 +509,10 @@ class hr_payslip(osv.osv):
worked_days = {}
for worked_days_line in payslip.worked_days_line_ids:
worked_days[worked_days_line.code] = worked_days_line
- input_lines = {}
+ inputs = {}
for input_line in payslip.input_line_ids:
- input_lines[input_line.code] = input_line
- localdict = {'heads': {}, 'payslip': payslip, 'worked_days': worked_days, 'input_lines': input_lines}
+ inputs[input_line.code] = input_line
+ localdict = {'heads': {}, 'payslip': payslip, 'worked_days': worked_days, 'inputs': inputs}
#get the ids of the structures on the contracts and their parent id as well
structure_ids = self.pool.get('hr.contract').get_all_structures(cr, uid, contract_ids, context=context)
#get the rules of the structure and thier children
@@ -627,7 +626,7 @@ class hr_payslip(osv.osv):
#computation of the salary input
worked_days_line_ids = self.get_worked_day_lines(cr, uid, contract_ids, date_from, date_to, context=context)
- input_line_ids = self.get_input_lines(cr, uid, contract_ids, date_from, date_to, context=context)
+ input_line_ids = self.get_inputs(cr, uid, contract_ids, date_from, date_to, context=context)
res['value'].update({
'worked_days_line_ids': worked_days_line_ids,
'input_line_ids': input_line_ids,
@@ -683,7 +682,7 @@ class hr_payslip_input(osv.osv):
'payslip_id': fields.many2one('hr.payslip', 'Pay Slip', required=True),
'sequence': fields.integer('Sequence', required=True,),
'code': fields.char('Code', size=52, required=True, help="The code that can be used in the salary rules"),
- 'quantity': fields.float('Quantity'),
+ 'quantity': fields.float('Quantity', help="It is used in computation. For e.g. A rule for sales having 1% commission of basic salary for per product can defined in expression like result = inputs['S-ASUS']['qunatity']*contract.wage*0.01."),
'contract_id': fields.many2one('hr.contract', 'Contract', required=True, help="The contract for which applied this input"),
}
_order = 'payslip_id, sequence'
@@ -744,6 +743,7 @@ class hr_salary_rule(osv.osv):
# rules: rules code (previously computed)
# heads: dictionary containing the computed heads (sum of amount of all rules belonging to that head). Keys are the head codes.
# worked_days: dictionary containing the computed worked days. Keys are the worked days codes.
+# inputs: dictionary containing the computed inputs. Keys are the inputs codes.
# Note: returned value have to be set in the variable 'result'
@@ -758,6 +758,7 @@ result = contract.wage * 0.10''',
# rules: rules code (previously computed)
# heads: dictionary containing the computed heads (sum of amount of all rules belonging to that head). Keys are the head codes.
# worked_days: dictionary containing the computed worked days. Keys are the worked days codes.
+# inputs: dictionary containing the computed inputs. Keys are the inputs codes.
# Note: returned value have to be set in the variable 'result'
diff --git a/addons/hr_payroll/hr_payroll_demo.xml b/addons/hr_payroll/hr_payroll_demo.xml
index db903fbabfe..5a6ccc2c995 100644
--- a/addons/hr_payroll/hr_payroll_demo.xml
+++ b/addons/hr_payroll/hr_payroll_demo.xml
@@ -60,6 +60,30 @@
Meal Voucher
+
+
+ code
+ SALE
+
+ Get 1% of sales
+
+ result = (inputs['S-ASUS']['quantity'] + inputs['S-CHINA']['quantity']) * contract.wage * 0.01
+
+
+
+
+
+ S-ASUS
+ Sale to ASUStek
+
+
+
+
+ S-CHINA
+ Sale to China Export
+
+
+
diff --git a/addons/hr_payroll/hr_payroll_view.xml b/addons/hr_payroll/hr_payroll_view.xml
index 1b0c8f82e32..7f40b7e7312 100644
--- a/addons/hr_payroll/hr_payroll_view.xml
+++ b/addons/hr_payroll/hr_payroll_view.xml
@@ -272,7 +272,7 @@
-
+
@@ -281,8 +281,19 @@
+
-
+
@@ -290,6 +301,16 @@
+
@@ -499,7 +520,7 @@
-
+
hr.salary.rule.tree
hr.salary.rule
tree
@@ -513,94 +534,112 @@
-
- hr.salary.rule.form
+
+ hr.salary.rule.form
+ hr.salary.rule
+ form
+
+
+
+
+
+
+ hr.salary.rule.select
hr.salary.rule
- form
+ search
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
- hr.salary.rule.select
- hr.salary.rule
- search
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ Salary Rules
+ hr.salary.rule
+ form
+
+ [('parent_rule_id','=',False)]
+
+
-
- Salary Rules
- hr.salary.rule
- form
-
- [('parent_rule_id','=',False)]
-
-
+
-
+
-
+
+ hr.contribution.register.form
+ hr.contribution.register
+ form
+
+
+
+
diff --git a/addons/hr_payroll/security/ir.model.access.csv b/addons/hr_payroll/security/ir.model.access.csv
index a5b2ee24201..7f54f1dd50b 100644
--- a/addons/hr_payroll/security/ir.model.access.csv
+++ b/addons/hr_payroll/security/ir.model.access.csv
@@ -11,3 +11,4 @@
"access_hr_payslip_worked_days ","hr.payslip.worked_days","model_hr_payslip_worked_days","base.group_hr_manager",1,1,1,1
"access_hr_salary_rule","hr.salary.rule","model_hr_salary_rule","base.group_hr_manager",1,1,1,1
"access_hr_payslip_input","hr.payslip.input","model_hr_payslip_input","base.group_hr_manager",1,1,1,1
+"access_hr_rule_input","hr.rule.input","model_hr_rule_input","base.group_hr_manager",1,1,1,1