From d91b1e5bd56373f869bdc0db2215818e9ce11cbc Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Tue, 6 Aug 2019 08:01:29 +0000 Subject: [PATCH] [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) --- addons/account/models/account_payment.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py index 1d654be0652..a192c0c8989 100644 --- a/addons/account/models/account_payment.py +++ b/addons/account/models/account_payment.py @@ -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):