From b8c5637e7ef4d7da262698cb025a57feca5afda4 Mon Sep 17 00:00:00 2001 From: Gustavo Valverde Date: Fri, 13 Jul 2018 10:57:09 +0000 Subject: [PATCH] [FIX] hr_payroll: Compute all payslips when closing batch Closing a Payslip Batch has to ensure that all payslips inside of it are well calculated and closed. Otherwise some helpers (as `sum`) won't work correctly because there are open payslips from the last month batch. This action ensures that if there's a Payslip Batch with 200+ employees, closing the Batch will complete the whole process including the accounting. closes odoo/odoo#25755 --- addons/hr_payroll/models/hr_payslip.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/hr_payroll/models/hr_payslip.py b/addons/hr_payroll/models/hr_payslip.py index 2f624db4d72..0c2eeb7aebf 100644 --- a/addons/hr_payroll/models/hr_payslip.py +++ b/addons/hr_payroll/models/hr_payslip.py @@ -506,4 +506,5 @@ class HrPayslipRun(models.Model): @api.multi def close_payslip_run(self): + self.mapped('slip_ids').filtered(lambda payslip: payslip.state != 'done').action_payslip_done() return self.write({'state': 'close'})