From ebf29dfc2e76506e021042008fa7a8e061388658 Mon Sep 17 00:00:00 2001 From: Gabriela Mogollon Date: Tue, 31 Jul 2018 20:08:45 +0000 Subject: [PATCH] [IMP] hr_payroll_account: Avoiding creating empty journal entries Purpose ======= Steps to reproduce ------------------ Install hr_payroll_account Configure a salary rule Create a payslip and confirm Current behavior ---------------- A journal entry is created without items. Expected behavior ----------------- Create the journal entry with all items like it's created When the payslip is computed (compute sheet button) and validated. resolve https://github.com/odoo/odoo/issues/24796 Specification ============= Now the super of ```action_payslip_done``` is called before the creation of the journal entry. This means that the ```compute_sheet``` method is called too before the filling of the account move. --- addons/hr_payroll_account/models/hr_payroll_account.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/hr_payroll_account/models/hr_payroll_account.py b/addons/hr_payroll_account/models/hr_payroll_account.py index da168912095..989d5f260f4 100644 --- a/addons/hr_payroll_account/models/hr_payroll_account.py +++ b/addons/hr_payroll_account/models/hr_payroll_account.py @@ -53,6 +53,7 @@ class HrPayslip(models.Model): @api.multi def action_payslip_done(self): + res = super(HrPayslip, self).action_payslip_done() precision = self.env['decimal.precision'].precision_get('Payroll') for slip in self: @@ -138,7 +139,7 @@ class HrPayslip(models.Model): move = self.env['account.move'].create(move_dict) slip.write({'move_id': move.id, 'date': date}) move.post() - return super(HrPayslip, self).action_payslip_done() + return res class HrSalaryRule(models.Model):