[MERGE] merged mtr's branch with new name for salary.head
authorQuentin (OpenERP) <qdp-launchpad@openerp.com>
Wed, 11 May 2011 13:21:48 +0000 (15:21 +0200)
committerQuentin (OpenERP) <qdp-launchpad@openerp.com>
Wed, 11 May 2011 13:21:48 +0000 (15:21 +0200)
bzr revid: qdp-launchpad@openerp.com-20110511132148-g2pyjq9oy6e88w6t

1  2 
addons/hr_payroll/hr_payroll.py
addons/hr_payroll/hr_payroll_view.xml
addons/hr_payroll/security/ir.model.access.csv

@@@ -471,31 -470,10 +471,31 @@@ class hr_payslip(osv.osv)
              res += [attendances] + leaves
          return res
  
 +    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')
 +
 +        structure_ids = contract_obj.get_all_structures(cr, uid, contract_ids, context=context)
 +        rule_ids = self.pool.get('hr.payroll.structure').get_all_rules(cr, uid, structure_ids, context=context)
 +        sorted_rule_ids = [id for id, sequence in sorted(rule_ids, key=lambda x:x[1])]
 +
 +        for contract in contract_obj.browse(cr, uid, contract_ids, context=context):
 +            for rule in rule_obj.browse(cr, uid, sorted_rule_ids, context=context):
 +                if rule.input_ids:
 +                    for input in rule.input_ids:
 +                        inputs = {
 +                             'name': input.name,
 +                             'code': input.code,
 +                             'contract_id': contract.id,
 +                        }
 +                        res += [inputs]
 +        return res
 +
      def get_payslip_lines(self, cr, uid, contract_ids, payslip_id, context):
-         def _sum_salary_category(localdict, category, amount):
+         def _sum_salary_rule_category(localdict, category, amount):
              if category.parent_id:
-                 localdict = _sum_salary_category(localdict, category.parent_id, amount)
+                 localdict = _sum_salary_rule_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
  
@@@ -738,9 -681,8 +738,9 @@@ class hr_salary_rule(osv.osv)
  # employee: hr.employee object
  # contract: hr.contract object
  # rules: rules code (previously computed)
- # categories: dictionary containing the computed categories (sum of amount of all rules belonging to that category). Keys are the category codes.
+ # categories: dictionary containing the computed salary rule 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.
 +# inputs: dictionary containing the computed inputs. Keys are the inputs codes.
  
  # Note: returned value have to be set in the variable 'result'
  
@@@ -753,9 -695,8 +753,9 @@@ result = contract.wage * 0.10'''
  # employee: hr.employee object
  # contract: hr.contract object
  # rules: rules code (previously computed)
- # categories: dictionary containing the computed categories (sum of amount of all rules belonging to that category). Keys are the category codes.
+ # categories: dictionary containing the computed salary rule 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.
 +# inputs: dictionary containing the computed inputs. Keys are the inputs codes.
  
  # Note: returned value have to be set in the variable 'result'
  
Simple merge