From b77ff40e931b18011f8ae5ee4f22d9706377eb2b Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Mon, 19 Mar 2018 15:39:07 +0100 Subject: [PATCH] [FIX] website_sale(_delivery): show prices according to B2B/B2C mode Before this commit: 1. The delivery price on checkout would always be shown without the taxes. This would make the cart total unclear since it is not indicated that this price is tax excluded. You could only assume that this was the price the delivery would cost you (and not just the untaxed delivery cost which you can't even find the full price anyway since taxes in subtotal is the sum of all products taxes). 2. The sale order line in payment step of checkout are always displayed with taxes. Now: We ensure that both 1. and 2. show the delivery price with or without taxes according to which mode (B2C or B2B) is enabled. This fixes #12872, closes #13592 and closes #23746 --- addons/website_sale/views/templates.xml | 3 ++- addons/website_sale_delivery/models/sale_order.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/website_sale/views/templates.xml b/addons/website_sale/views/templates.xml index 566a353f8aeb6..67969cb97ee46 100644 --- a/addons/website_sale/views/templates.xml +++ b/addons/website_sale/views/templates.xml @@ -1321,7 +1321,8 @@
- + + diff --git a/addons/website_sale_delivery/models/sale_order.py b/addons/website_sale_delivery/models/sale_order.py index 279dd758711c9..63f2f20208b8e 100644 --- a/addons/website_sale_delivery/models/sale_order.py +++ b/addons/website_sale_delivery/models/sale_order.py @@ -27,7 +27,10 @@ class SaleOrder(models.Model): @api.depends('order_line.price_unit', 'order_line.tax_id', 'order_line.discount', 'order_line.product_uom_qty') def _compute_amount_delivery(self): for order in self: - order.amount_delivery = sum(order.order_line.filtered('is_delivery').mapped('price_subtotal')) + if self.env.user.has_group('sale.group_show_price_subtotal'): + order.amount_delivery = sum(order.order_line.filtered('is_delivery').mapped('price_subtotal')) + else: + order.amount_delivery = sum(order.order_line.filtered('is_delivery').mapped('price_total')) @api.depends('order_line.is_delivery') def _compute_has_delivery(self):