diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index 132d8fc1104..e4597aa0c8d 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -164,17 +164,17 @@ class contrib_register(osv.osv): contrib_register() -class hr_salary_head(osv.osv): +class hr_salary_category(osv.osv): """ - HR Salary Head + HR Salary Category """ - _name = 'hr.salary.head' - _description = 'Salary Head' + _name = 'hr.salary.category' + _description = 'Salary Category' _columns = { 'name':fields.char('Name', size=64, required=True, readonly=False), 'code':fields.char('Code', size=64, required=True, readonly=False), - 'parent_id':fields.many2one('hr.salary.head', 'Parent', help="Linking a salary head to its parent is used only for the reporting purpose."), + 'parent_id':fields.many2one('hr.salary.category', 'Parent', help="Linking a salary category to its parent is used only for the reporting purpose."), 'note': fields.text('Description'), 'company_id':fields.many2one('res.company', 'Company', required=False), 'sequence': fields.integer('Sequence', required=True, help='Display sequence order'), @@ -187,7 +187,7 @@ class hr_salary_head(osv.osv): 'sequence': 5 } -hr_salary_head() +hr_salary_category() class one2many_mod2(fields.one2many): @@ -212,11 +212,11 @@ class hr_payslip(osv.osv): _name = 'hr.payslip' _description = 'Pay Slip' - def _get_lines_salary_head(self, cr, uid, ids, field_names, arg=None, context=None): + def _get_lines_salary_category(self, cr, uid, ids, field_names, arg=None, context=None): result = {} if not ids: return result cr.execute('''SELECT pl.slip_id, pl.id FROM hr_payslip_line AS pl \ - LEFT JOIN hr_salary_head AS sh on (pl.category_id = sh.id) \ + LEFT JOIN hr_salary_category AS sh on (pl.category_id = sh.id) \ WHERE pl.slip_id in %s \ GROUP BY pl.slip_id, sh.sequence, pl.sequence, pl.id ORDER BY sh.sequence, pl.sequence''',(tuple(ids),)) res = cr.fetchall() @@ -253,7 +253,7 @@ class hr_payslip(osv.osv): 'paid': fields.boolean('Made Payment Order ? ', required=False, readonly=True, states={'draft': [('readonly', False)]}), 'note': fields.text('Description'), 'contract_id': fields.many2one('hr.contract', 'Contract', required=False, readonly=True, states={'draft': [('readonly', False)]}), - 'details_by_salary_head': fields.function(_get_lines_salary_head, method=True, type='one2many', relation='hr.payslip.line', string='Details by Salary Head'), + 'details_by_salary_category': fields.function(_get_lines_salary_category, method=True, type='one2many', relation='hr.payslip.line', string='Details by Salary Head'), 'credit_note': fields.boolean('Credit Note', help="Indicates this payslip has a refund of another"), } _defaults = { @@ -473,10 +473,10 @@ class hr_payslip(osv.osv): return res def get_payslip_lines(self, cr, uid, contract_ids, payslip_id, context): - def _sum_salary_head(localdict, head, amount): - if head.parent_id: - localdict = _sum_salary_head(localdict, head.parent_id, amount) - localdict['heads'][head.code] = head.code in localdict['heads'] and localdict['heads'][head.code] + amount or amount + def _sum_salary_category(localdict, category, amount): + if category.parent_id: + localdict = _sum_salary_category(localdict, category.parent_id, amount) + localdict['categories'][category.code] = category.code in localdict['categories'] and localdict['categories'][category.code] + amount or amount return localdict #we keep a dict with the result because a value can be overwritten by another rule with the same code @@ -487,7 +487,7 @@ class hr_payslip(osv.osv): worked_days = {} for input_line in payslip.input_line_ids: worked_days[input_line.code] = input_line - localdict = {'heads': {}, 'payslip': payslip, 'worked_days': worked_days} + localdict = {'categories': {}, 'payslip': payslip, 'worked_days': worked_days} #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 @@ -510,7 +510,7 @@ class hr_payslip(osv.osv): #set/overwrite the amount computed for this rule in the localdict localdict[rule.code] = amount #sum the amount for its salary head - localdict = _sum_salary_head(localdict, rule.category_id, amount - previous_amount) + localdict = _sum_salary_category(localdict, rule.category_id, amount - previous_amount) #create/overwrite the rule in the temporary results result_dict[key] = { 'salary_rule_id': rule.id, @@ -644,7 +644,7 @@ class hr_salary_rule(osv.osv): 'code':fields.char('Code', size=64, required=True), 'sequence': fields.integer('Sequence', required=True, help='Use to arrange calculation sequence'), 'quantity': fields.char('Quantity', size=256, help="It is used in computation for percentage and fixed amount.For e.g. A rule for Meal Voucher having fixed amount of 1€ per worked day can have its quantity defined in expression like worked_days['WORK100']['number_of_days']."), - 'category_id':fields.many2one('hr.salary.head', 'Salary Head', required=True), + 'category_id':fields.many2one('hr.salary.category', 'Category', required=True), 'active':fields.boolean('Active', help="If the active field is set to false, it will allow you to hide the salary rule without removing it."), 'appears_on_payslip': fields.boolean('Appears on Payslip', help="Used for the display of rule on payslip"), 'parent_rule_id':fields.many2one('hr.salary.rule', 'Parent Salary Rule', select=True), @@ -684,7 +684,7 @@ class hr_salary_rule(osv.osv): # employee: hr.employee object # contract: hr.contract object # 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. +# categories: dictionary containing the computed categories (sum of amount of all rules belonging to that category). Keys are the category codes. # worked_days: dictionary containing the computed worked days. Keys are the worked days codes. # Note: returned value have to be set in the variable 'result' @@ -698,12 +698,12 @@ result = contract.wage * 0.10''', # employee: hr.employee object # contract: hr.contract object # 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. +# categories: dictionary containing the computed categories (sum of amount of all rules belonging to that category). Keys are the category codes. # worked_days: dictionary containing the computed worked days. Keys are the worked days codes. # Note: returned value have to be set in the variable 'result' -result = rules['NET'] > heads['NET'] * 0.10''', +result = rules['NET'] > categories['NET'] * 0.10''', 'condition_range': 'contract.wage', 'sequence': 5, 'appears_on_payslip': True, diff --git a/addons/hr_payroll/hr_payroll_data.xml b/addons/hr_payroll/hr_payroll_data.xml index 21273bfa725..49253ca90b4 100644 --- a/addons/hr_payroll/hr_payroll_data.xml +++ b/addons/hr_payroll/hr_payroll_data.xml @@ -2,32 +2,32 @@ - + Basic BASIC - + Allowance ALW - + Deduction DED - + Gross GROSS - + Net NET - + Company Contribution COMP @@ -177,7 +177,7 @@ none code - result = heads['BASIC'] + ('ALW' in heads and heads['ALW'] or 0.0) + result = categories['BASIC'] + ('ALW' in categories and categories['ALW'] or 0.0) @@ -187,7 +187,7 @@ none code - result = heads['BASIC'] + ('ALW' in heads and heads['ALW'] or 0.0) + ('DED' in heads and heads['DED'] or 0.0) + result = categories['BASIC'] + ('ALW' in categories and categories['ALW'] or 0.0) + ('DED' in categories and categories['DED'] or 0.0) diff --git a/addons/hr_payroll/hr_payroll_view.xml b/addons/hr_payroll/hr_payroll_view.xml index 40a52a6c74e..1f39afc2462 100644 --- a/addons/hr_payroll/hr_payroll_view.xml +++ b/addons/hr_payroll/hr_payroll_view.xml @@ -260,8 +260,8 @@ - - + + @@ -347,9 +347,9 @@ - - hr.salary.head.form - hr.salary.head + + hr.salary.category.form + hr.salary.category form
@@ -365,9 +365,9 @@ - - hr.salary.head.tree - hr.salary.head + + hr.salary.category.tree + hr.salary.category tree @@ -379,9 +379,9 @@ - - hr.salary.head.select - hr.salary.head + + hr.salary.category.select + hr.salary.category search @@ -391,16 +391,16 @@ - - Salary Heads - hr.salary.head + + Salary Categories + hr.salary.category form - - + + diff --git a/addons/hr_payroll/security/ir.model.access.csv b/addons/hr_payroll/security/ir.model.access.csv index 609fc99c034..9fe2fd67498 100644 --- a/addons/hr_payroll/security/ir.model.access.csv +++ b/addons/hr_payroll/security/ir.model.access.csv @@ -1,7 +1,7 @@ "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" "access_hr_payroll_structure","hr.payroll.structure","model_hr_payroll_structure","base.group_hr_user",1,1,1,1 "access_hr_contribution_register","hr.contribution.register","model_hr_contribution_register","base.group_hr_user",1,1,1,1 -"access_hr_salary_head","hr.salary.head","model_hr_salary_head","base.group_hr_user",1,1,1,1 +"access_hr_salary_category","hr.salary.category","model_hr_salary_category","base.group_hr_user",1,1,1,1 "access_hr_payslip","hr.payslip","model_hr_payslip","base.group_hr_user",1,1,1,1 "access_hr_payslip_line","hr.payslip.line","model_hr_payslip_line","base.group_hr_user",1,1,1,1 "access_res_partner_payroll","res.partner.payroll","base.model_res_partner","base.group_hr_user",1,1,1,1