[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
This commit is contained in:
Prakash Prajapati
2019-02-13 09:43:36 +00:00
committed by Yannick Tivisse
parent 30128860da
commit 984bf2492a
+1 -1
View File
@@ -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: