diff options
| author | Damien Bouvy <dbo@odoo.com> | 2016-02-02 13:17:02 +0100 |
|---|---|---|
| committer | Damien Bouvy <dbo@odoo.com> | 2016-02-02 14:23:09 +0100 |
| commit | a7c664fb6cfce730309197fcb71bca4dc9a9084d (patch) | |
| tree | 43469b014ef859900a7d3cb17a4bada9f990f08d /addons | |
| parent | fbd5fab238e85958da1e6a0f63a1c22de3ba17e9 (diff) | |
[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.
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/website_quote/models/order.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/addons/website_quote/models/order.py b/addons/website_quote/models/order.py index cda5d83e275..05a58e375ae 100644 --- a/addons/website_quote/models/order.py +++ b/addons/website_quote/models/order.py @@ -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} |
