Skip to content

Commit

Permalink
[FIX] website_sale(_delivery): show prices according to B2B/B2C mode
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rdeodoo committed Mar 20, 2018
1 parent 75d9a2b commit b77ff40
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion addons/website_sale/views/templates.xml
Expand Up @@ -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>
Expand Down
5 changes: 4 additions & 1 deletion addons/website_sale_delivery/models/sale_order.py
Expand Up @@ -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):
Expand Down

0 comments on commit b77ff40

Please sign in to comment.