From 052a5702c500a745fa94d13244eeaf14baccecb8 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 29 Aug 2018 15:48:02 +0200 Subject: [PATCH] [FIX] purchase: keep vendor reference Create a PO and assign any string to the Vendor Reference field. Confirm and create an invoice. The Vendor Reference field on the invoice is empty, while it is expected to be filled in. opw-1879379 --- addons/purchase/models/account_invoice.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/purchase/models/account_invoice.py b/addons/purchase/models/account_invoice.py index e7e801429d1..a820c28923d 100644 --- a/addons/purchase/models/account_invoice.py +++ b/addons/purchase/models/account_invoice.py @@ -101,8 +101,8 @@ class AccountInvoice(models.Model): @api.onchange('invoice_line_ids') def _onchange_origin(self): purchase_ids = self.invoice_line_ids.mapped('purchase_id') - if purchase_ids: - self.origin = ', '.join(purchase_ids.mapped('name')) + self.origin = ', '.join(purchase_ids.mapped('name')) + self.reference = ', '.join(purchase_ids.filtered('partner_ref').mapped('partner_ref')) @api.onchange('partner_id', 'company_id') def _onchange_partner_id(self):