From fcc698c8ed20d6a6c605f60a61e6325e4b0746f9 Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Fri, 24 Nov 2023 09:09:01 +0000 Subject: [PATCH] [FIX] account: payment reference blanking propagation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Create a vendor bill Input any value in the "payment reference field" > save Payment line name will be set to the payment reference Remove the value > save Issue: Payment line name will be unchanged Register payment In the payment wizard, the "memo" field will be filled with the old payment reference. opw-3596003 closes odoo/odoo#145213 X-original-commit: eae97ce895e3cae713463eef2c11bcd64f3fd003 Signed-off-by: William André (wan) Signed-off-by: Andrea Grazioso (agr) --- .../account/tests/test_account_move_in_invoice.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/addons/account/tests/test_account_move_in_invoice.py b/addons/account/tests/test_account_move_in_invoice.py index 7cc96e4f648..63237fbf523 100644 --- a/addons/account/tests/test_account_move_in_invoice.py +++ b/addons/account/tests/test_account_move_in_invoice.py @@ -2368,3 +2368,16 @@ class TestAccountMoveInInvoiceOnchanges(AccountTestInvoicingCommon): move_form.save() self.assertEqual(invoice.currency_id, chf, "Changing to a journal with a set currency should change invoice currency") + + def test_onchange_payment_reference(self): + """ + Ensure payment reference propagation from move to payment term + line is done correctly + """ + payment_term_line = self.invoice.line_ids.filtered(lambda l: l.display_type == 'payment_term') + with Form(self.invoice) as move_form: + move_form.payment_reference = 'test' + self.assertEqual(payment_term_line.name, 'test') + with Form(self.invoice) as move_form: + move_form.payment_reference = False + self.assertEqual(payment_term_line.name, '', 'Payment term line was not changed')