From a65092f66b6d8a3bad72b979144eeb86905cd8e9 Mon Sep 17 00:00:00 2001 From: robinkeunen Date: Fri, 15 Jun 2018 18:45:40 +0200 Subject: [PATCH] [IMP] add product code in product name on PO creaption from CPO --- compute_purchase_order/models/computed_purchase_order.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compute_purchase_order/models/computed_purchase_order.py b/compute_purchase_order/models/computed_purchase_order.py index 2c4bb62..112ead8 100644 --- a/compute_purchase_order/models/computed_purchase_order.py +++ b/compute_purchase_order/models/computed_purchase_order.py @@ -170,8 +170,12 @@ class ComputedPurchaseOrder(models.Model): for cpo_line in self.order_line_ids: if cpo_line.purchase_quantity > 0: + if cpo_line.supplierinfo_id.product_code: + pol_name = '[%s] %s' % (cpo_line.supplierinfo_id.product_code, cpo_line.name) + else: + pol_name = cpo_line.name pol_values = { - 'name': cpo_line.name, + 'name': pol_name, 'product_id': cpo_line.get_default_product_product().id, 'product_qty': cpo_line.purchase_quantity, 'price_unit': cpo_line.product_price,