[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.
This commit is contained in:
Gabriela Mogollon
2018-08-10 11:09:15 +02:00
committed by Yannick Tivisse
parent 21064c7de8
commit ebf29dfc2e
@@ -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):