From 984bf2492a16f0ff357b3fc03712c68f1a011f96 Mon Sep 17 00:00:00 2001 From: Prakash Prajapati Date: Wed, 13 Feb 2019 09:36:44 +0000 Subject: [PATCH] [IMP] product: Use the vendor code in 'Customer Ref' if set Currently the 'partner_ref' field is used when generating purchase orders lines. It computed like this: Customer Ref : Vendor Product Name on the supplier info OR internal reference of the product OR product name As we can set an alternative internal reference for the vendor, that should be used instead of the internal reference of the product, this commit will compute it as follows: Customer Ref : Vendor Product Name on the supplier info OR vendor product code on the supplier info OR internal reference of the product OR product name closes odoo/odoo#28573 --- addons/product/models/product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product/models/product.py b/addons/product/models/product.py index b80f5656f9e..7f37b7ee74c 100644 --- a/addons/product/models/product.py +++ b/addons/product/models/product.py @@ -235,7 +235,7 @@ class ProductProduct(models.Model): def _compute_partner_ref(self): for supplier_info in self.seller_ids: if supplier_info.name.id == self._context.get('partner_id'): - product_name = supplier_info.product_name or self.default_code or self.name + product_name = supplier_info.product_name or supplier_info.product_code or self.default_code or self.name self.partner_ref = '%s%s' % (self.code and '[%s] ' % self.code or '', product_name) break else: