From 4f10dfa5278c0e3510db28cecf577e3fefb9373f Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 18 Aug 2020 09:16:39 +0000 Subject: [PATCH] [FIX] sale, sale_management: add tax on options (portal) Steps to reproduce Enable optional products in sale order Make a sale order with optional products for a portal customer with taxcloud fiscal position. Validate the order. Tax will be calculated on the sol. Access the sale order as the portal user. Add the optional product, verify the order and pay. The optional product will get the taxcloud data AFTER the order has been verified and possibly paid. As this should not occur this add the override to calculate taxcloud data right after adding the optional product opw-2310614 closes odoo/odoo#56110 X-original-commit: a7a91d5de55817b7580f3cd3d262a9dcce7496e7 Signed-off-by: Simon Goffin (sig) Co-authored-by: agr-odoo --- addons/sale/models/sale.py | 3 +++ addons/sale_management/models/sale_order.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index 8e9912de39e..7d2a85e060a 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -1060,6 +1060,9 @@ Reason(s) of this behavior could be: down_payments_section_line.update(optional_values) return down_payments_section_line + def add_option_to_order_with_taxcloud(self): + self.ensure_one() + class SaleOrderLine(models.Model): _name = 'sale.order.line' diff --git a/addons/sale_management/models/sale_order.py b/addons/sale_management/models/sale_order.py index f2ea0512f8b..4677c49ab36 100644 --- a/addons/sale_management/models/sale_order.py +++ b/addons/sale_management/models/sale_order.py @@ -250,6 +250,9 @@ class SaleOrderOption(models.Model): order_line._compute_tax_id() self.write({'line_id': order_line.id}) + if sale_order: + sale_order.add_option_to_order_with_taxcloud() + def _get_values_to_add_to_order(self): self.ensure_one()