[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
This commit is contained in:
parent
e30a5a11a5
commit
78144410a4
|
@ -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 = {
|
||||
|
|
Loading…
Reference in New Issue