diff options
| author | Goffin Simon <sig@odoo.com> | 2021-04-19 16:15:30 +0000 |
|---|---|---|
| committer | Goffin Simon <sig@odoo.com> | 2021-04-23 07:23:59 +0000 |
| commit | a1beb1a4b3d7cc9724f5a9adeb1183c0a89e175f (patch) | |
| tree | 75f3144dbc9fee3cc201cd179f670ed6a5225cfa /addons/website_sale/models | |
| parent | 5430c416937a10678d035d8c162031ae3b5a31e0 (diff) | |
[FIX] website_sale: Display discounted price with included tax
Steps to reproduce the bug:
- Let's consider a company in $
- Let's consider two sales taxes T1 (10% included) and T2 (0%)
- Define a fiscal position FP that maps T1 to T2
- Define a product P with T1, price = 11$ and available in the shop
- Define a pricelist PL in € such as 1€ = 2$, show discount to customer and discount P with 50%
- Define a portal user PU with FP and PL
- Log with PU
- Add P in the cart
Bug:
The unit price of P was 2,75€ instead of 2,5€ and the discounted price was 10€ instead of 5€
PS: Before adding P in the cart, the correct unit price and discounted price were displayed.
opw:2472528
closes odoo/odoo#69715
X-original-commit: ea259218196b2d9dc71beffea697025580c6d696
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Diffstat (limited to 'addons/website_sale/models')
| -rw-r--r-- | addons/website_sale/models/sale_order.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/addons/website_sale/models/sale_order.py b/addons/website_sale/models/sale_order.py index 53efba7460f..d270c51714d 100644 --- a/addons/website_sale/models/sale_order.py +++ b/addons/website_sale/models/sale_order.py @@ -245,21 +245,21 @@ class SaleOrder(models.Model): # update line no_variant_attributes_price_extra = [ptav.price_extra for ptav in order_line.product_no_variant_attribute_value_ids] values = self.with_context(no_variant_attributes_price_extra=tuple(no_variant_attributes_price_extra))._website_product_id_change(self.id, product_id, qty=quantity) + order = self.sudo().browse(self.id) if self.pricelist_id.discount_policy == 'with_discount' and not self.env.context.get('fixed_price'): - order = self.sudo().browse(self.id) product_context.update({ 'partner': order.partner_id, 'quantity': quantity, 'date': order.date_order, 'pricelist': order.pricelist_id.id, }) - product_with_context = self.env['product.product'].with_context(product_context).with_company(order.company_id.id) - product = product_with_context.browse(product_id) - values['price_unit'] = self.env['account.tax']._fix_tax_included_price_company( - order_line._get_display_price(product), - order_line.product_id.taxes_id, - order_line.tax_id, - self.company_id + product_with_context = self.env['product.product'].with_context(product_context).with_company(order.company_id.id) + product = product_with_context.browse(product_id) + values['price_unit'] = self.env['account.tax']._fix_tax_included_price_company( + order_line._get_display_price(product), + order_line.product_id.taxes_id, + order_line.tax_id, + self.company_id ) order_line.write(values) |
