[FIX] website_sale: base unit price not updated with pricelist and tax
Steps to reproduce: - set a price on the product form; - set a base unit count on the product form; - define at least a pricelist with an other price; - go to website on the product page; - change the selected pricelist; - change the Tax-Excluded/Included option. Issue: The base unit price ignores the tax included option. Solution: Update the display of the base unit price taking into consideration that it is not possible to set the "base_unit_price" field (otherwise we risk an AccessError). Calculate the base unit price using "list_price" (which takes into account the tax) when we need to display it without saving. opw-2995474 closes odoo/odoo#104302 X-original-commit: b766d68287b73b70a784e7291c567fb2e59de0c3 Signed-off-by: William Braeckman (wbr) <wbr@odoo.com> Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
This commit is contained in:
@@ -272,7 +272,7 @@ class ProductTemplate(models.Model):
|
||||
prevent_zero_price_sale = not price and current_website.prevent_zero_price_sale
|
||||
combination_info.update(
|
||||
base_unit_name=product.base_unit_name,
|
||||
base_unit_price=base_unit_price,
|
||||
base_unit_price=product.base_unit_count and list_price / product.base_unit_count,
|
||||
price=price,
|
||||
list_price=list_price,
|
||||
price_extra=price_extra,
|
||||
|
||||
@@ -870,10 +870,8 @@
|
||||
|
||||
<!-- /shop/product page -->
|
||||
<template id="base_unit_price" name="Product Bas eunit price">
|
||||
<t>
|
||||
(<span class="o_base_unit_price" t-field="product.base_unit_price" t-options="{'display_currency': website.currency_id}"/>
|
||||
/ <span class="oe_custom_base_unit" t-field="product.base_unit_name"/>)
|
||||
</t>
|
||||
(<span class="o_base_unit_price" t-esc="combination_info['base_unit_price']" t-options="{'widget': 'monetary', 'display_currency': website.currency_id}"/>
|
||||
/ <span class="oe_custom_base_unit" t-field="product.base_unit_name"/>)
|
||||
</template>
|
||||
|
||||
<template id="product" name="Product" track="1">
|
||||
@@ -1451,6 +1449,9 @@
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-center td-price" name="price">
|
||||
<t t-set="combination" t-value="line.product_id.product_template_attribute_value_ids + line.product_no_variant_attribute_value_ids"/>
|
||||
<t t-set="combination_info" t-value="line.product_id.product_tmpl_id._get_combination_info(combination, pricelist=website_sale_order.pricelist_id, add_qty=line.product_uom_qty)"/>
|
||||
|
||||
<t groups="account.group_show_line_subtotals_tax_excluded">
|
||||
<span t-field="line.price_reduce_taxexcl" style="white-space: nowrap;" t-options="{'widget': 'monetary', 'display_currency': website_sale_order.currency_id}"/>
|
||||
</t>
|
||||
|
||||
Reference in New Issue
Block a user