[FIX] product: fallback on global partner property after the country groups matching

Default porperty was overriding localization filter.
This commit is contained in:
Jeremy Kersten
2016-09-21 21:29:18 +02:00
parent df2a28c86f
commit eb90e11134
+8 -3
View File
@@ -307,14 +307,19 @@ class Pricelist(models.Model):
pls = self.env['product.pricelist'].search([('country_group_ids.country_ids.code', '=', p.country_id.code)], limit=1)
pl = pls and pls[0].id
if not pl:
pl = Property.get('property_product_pricelist', 'res.partner').id
if not pl:
# search pl where no country
pls = self.env['product.pricelist'].search([('country_group_ids', '=', False)], limit=1)
pl = pls and pls[0].id
if not pl:
prop = Property.get('property_product_pricelist', 'res.partner')
pl = prop and prop[0].id
if not pl:
pls = self.env['product.pricelist'].search([], limit=1)
pl = pls and pls[0].id
return pl