[FIX] website_quote: handling of uoms in _onchange_product_id

The condition self.uom_id != self.product_id.uom_id could actually
never be met, since a few lines before you could read
self.uom_id = product.product_tmpl_id.uom_id. From now on, simply
check if the uom_id on the cached record is different from the one
on the product and check the price using the pricelist (_compute_price
does not take pricelists into account) with the wonderfully explicit
with_context call.
This commit is contained in:
Damien Bouvy
2016-02-02 14:23:09 +01:00
parent fbd5fab238
commit a7c664fb6c
+4 -6
View File
@@ -414,13 +414,11 @@ class sale_order_option(osv.osv):
self.name = product.name
if product.description_sale:
self.name += '\n' + product.description_sale
self.uom_id = product.product_tmpl_id.uom_id
if product and self.order_id.pricelist_id:
self.uom_id = self.uom_id or product.uom_id
pricelist = self.order_id.pricelist_id
if pricelist and product:
partner_id = self.order_id.partner_id.id
pricelist = self.order_id.pricelist_id.id
self.price_unit = self.order_id.pricelist_id.price_get(product.id, self.quantity, partner_id)[pricelist]
if self.uom_id and self.uom_id != self.product_id.uom_id:
self.price_unit = self.product_id.uom_id._compute_price(self.price_unit, self.uom_id.id)
self.price_unit = pricelist.with_context(uom=self.uom_id.id).price_get(product.id, self.quantity, partner_id)[pricelist.id]
domain = {'uom_id': [('category_id', '=', self.product_id.uom_id.category_id.id)]}
return {'domain': domain}