[FIX] account: payment cancel resets name

Make a transfer payment from bank to cash
validate, check the journal entries
You see that there are two moves, each with the name
given by their journal's sequence (one in bank, one in cash)

Now, unreconcile, and cancel the payment
set it to draft, re-confirm it

Before this commit, the entries created had the same name which was
the name of the previous journal entry
This was because, at cancel time, the move_name of the payment was not reset

After this commit, the move name is reset on cancel, and both
journal entries have a new sequence based name when
confirming the payment the second time

OPW 2046412

closes odoo/odoo#35478

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
This commit is contained in:
Lucas Perais (lpe)
2019-08-06 08:01:29 +00:00
parent 11fb681d2b
commit d91b1e5bd5
+4 -1
View File
@@ -473,7 +473,10 @@ class account_payment(models.Model):
move.line_ids.remove_move_reconcile()
move.button_cancel()
move.unlink()
rec.state = 'cancelled'
rec.write({
'state': 'cancelled',
'move_name': False,
})
@api.multi
def unlink(self):