From 78144410a4e3e59e8e7f06fb527e7aba8321d4b2 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 2 Oct 2014 10:12:51 +0200 Subject: [PATCH] [IMP] product: name_get matching on commercial_partner_id for suppliers The name_get of a product will use some information (e.g. default_code) based on the supplier. The matching of the supplier should use the commercial_partner_id in case the supplier info are on the company and the partner_id in the context belongs to the company (e.g. creates quotation with a contact of the company). Fixes #1219 --- addons/product/product.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/product/product.py b/addons/product/product.py index 124ce313f37..7a36507aa79 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -645,10 +645,14 @@ class product_product(osv.osv): return (d['id'], name) partner_id = context.get('partner_id', False) + if partner_id: + partner_ids = [partner_id, self.pool['res.partner'].browse(cr, user, partner_id, context=context).commercial_partner_id.id] + else: + partner_ids = [] result = [] for product in self.browse(cr, user, ids, context=context): - sellers = filter(lambda x: x.name.id == partner_id, product.seller_ids) + sellers = partner_ids and filter(lambda x: x.name.id in partner_ids, product.seller_ids) or [] if sellers: for s in sellers: mydict = {