[FIX] account: payment reference blanking propagation

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) <wan@odoo.com>
Signed-off-by: Andrea Grazioso (agr) <agr@odoo.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2023-12-06 17:27:44 +00:00
parent 0629e34715
commit fcc698c8ed
@@ -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')