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
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 = {