From 3fe24ac5e7c763d518af2285f786765af16deb67 Mon Sep 17 00:00:00 2001 From: wan Date: Fri, 11 Oct 2019 09:19:49 +0000 Subject: [PATCH] [FIX] account: add the payment reference on the payment OPW 2082843 The communication on the register payment took the vendor reference or the invoice name by default. Now, it first looks at the payment reference value. closes odoo/odoo#38683 X-original-commit: 6e1a821818e478c49407474446b2e0a521889194 Signed-off-by: Laurent Smet --- addons/account/models/account_payment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py index e521a773a9c..70773401d7e 100644 --- a/addons/account/models/account_payment.py +++ b/addons/account/models/account_payment.py @@ -121,7 +121,7 @@ class account_payment(models.Model): 'payment_type': 'inbound' if amount > 0 else 'outbound', 'partner_id': invoices[0].commercial_partner_id.id, 'partner_type': MAP_INVOICE_TYPE_PARTNER_TYPE[invoices[0].type], - 'communication': invoices[0].ref or invoices[0].name, + 'communication': invoices[0].invoice_payment_ref or invoices[0].ref or invoices[0].name, 'invoice_ids': [(6, 0, invoices.ids)], }) return rec @@ -782,7 +782,7 @@ class payment_register(models.TransientModel): 'journal_id': self.journal_id.id, 'payment_method_id': self.payment_method_id.id, 'payment_date': self.payment_date, - 'communication': " ".join(i.ref or i.name for i in invoices), + 'communication': " ".join(i.invoice_payment_ref or i.ref or i.name for i in invoices), 'invoice_ids': [(6, 0, invoices.ids)], 'payment_type': ('inbound' if amount > 0 else 'outbound'), 'amount': abs(amount),