diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index 4d886bed176..dda33048a23 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -813,6 +813,7 @@ class SaleOrderLine(models.Model): @api.multi def _get_display_price(self, product): + # TO DO: move me in master/saas-16 on sale.order if self.order_id.pricelist_id.discount_policy == 'without_discount': from_currency = self.order_id.company_id.currency_id return from_currency.compute(product.lst_price, self.order_id.pricelist_id.currency_id) diff --git a/addons/website_sale/models/sale_order.py b/addons/website_sale/models/sale_order.py index a0fe0e707e7..0d277be82ff 100644 --- a/addons/website_sale/models/sale_order.py +++ b/addons/website_sale/models/sale_order.py @@ -68,12 +68,18 @@ class SaleOrder(models.Model): }) product = self.env['product.product'].with_context(product_context).browse(product_id) + pu = product.price + if order.pricelist_id and order.partner_id: + order_line = order._cart_find_product_line(product.id) + if order_line: + pu = self.env['account.tax']._fix_tax_included_price(order_line._get_display_price(product), product.taxes_id, order_line.tax_id) + return { 'product_id': product_id, 'product_uom_qty': qty, 'order_id': order_id, 'product_uom': product.uom_id.id, - 'price_unit': product.price, + 'price_unit': pu, } @api.multi @@ -144,10 +150,12 @@ class SaleOrder(models.Model): # update line values = self._website_product_id_change(self.id, product_id, qty=quantity) - - if self.pricelist_id.discount_policy == 'with_discount' and not self.env.context.get('fixed_price'): - values['price_unit'] = order_line._get_display_price(order_line.product_id) + values['price_unit'] = self.env['account.tax']._fix_tax_included_price( + order_line._get_display_price(order_line.product_id), + order_line.product_id.taxes_id, + order_line.tax_id + ) order_line.write(values)