[FIX] website_sale: default pricelist

The default pricelist set for visitors
in the ecommerce must be part of the available
pricelists (available according to the country)

The pricelist of the public user may
not amongs the available pricelists.

opw-665536
This commit is contained in:
Denis Ledoux
2016-01-14 16:20:32 +01:00
parent 6e1ed6c8bb
commit 698c0c557d
+5 -1
View File
@@ -224,7 +224,11 @@ class website(orm.Model):
if pl_id:
return self.pool['product.pricelist'].browse(cr, uid, [pl_id], context=context)[0]
else:
pl = self.pool['res.users'].browse(cr, SUPERUSER_ID, uid, context=context).partner_id.property_product_pricelist
available_pricelists = self.get_pricelist_available(cr, uid, context=context)
if available_pricelists:
pl = available_pricelists[0]
else:
pl = self.pool['res.users'].browse(cr, SUPERUSER_ID, uid, context=context).partner_id.property_product_pricelist
request.session['website_sale_current_pl'] = pl.id
return pl