[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
This commit is contained in:
Romain Derie
2018-03-20 14:29:59 +01:00
parent 75d9a2b4db
commit b77ff40e93
2 changed files with 6 additions and 2 deletions
+2 -1
View File
@@ -1321,7 +1321,8 @@
<div t-esc="int(line.product_uom_qty) == line.product_uom_qty and int(line.product_uom_qty) or line.product_uom_qty" />
</td>
<td class="text-center">
<span t-field="line.price_unit" style="white-space: nowrap;" t-options="{'widget': 'monetary','from_currency': website_sale_order.pricelist_id.currency_id,'display_currency': website.currency_id}" />
<span t-field="line.price_reduce_taxexcl" style="white-space: nowrap;" t-options="{'widget': 'monetary', 'from_currency': website_sale_order.pricelist_id.currency_id, 'display_currency': website.currency_id}" groups="sale.group_show_price_subtotal" />
<span t-field="line.price_reduce_taxinc" style="white-space: nowrap;" t-options="{'widget': 'monetary', 'from_currency': website_sale_order.pricelist_id.currency_id, 'display_currency': website.currency_id}" groups="sale.group_show_price_total" />
</td>
</tr>
</tbody>
@@ -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):