Commit e96645d7 authored by jira's avatar jira
Browse files

[FIX] hr.payslip.run: action_done and action_draft now working

parent bdd5327d
......@@ -21,6 +21,23 @@ class HrPayslipRun(models.Model):
struct_id = fields.Many2one('hr.payroll.structure', name='Struct')
@api.multi
def draft_payslip_run(self):
slips = self.mapped("slip_ids")
slips.action_payslip_cancel()
slips.write({'state': 'draft'})
return super(HrPayslipRun, self).draft_payslip_run()
@api.multi
def close_payslip_run(self):
ctx = dict(self.env.context)
for form in self:
ctx['accounting_date'] = form.accounting_date
for slip in form.slip_ids.with_context(ctx):
slip.with_context(compute_sheet=False).action_payslip_done()
return super(HrPayslipRun, self).close_payslip_run()
def _recompute_slip_ids(self):
return self.slip_ids.compute_sheet()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment