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
# 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'
# 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'