Daily updates from Odoo
Monday, August 5, 2024
1 change · saas-17.2
Resolved issues and error corrections
Point of Sale receipts now show the correct base and total amounts when a tax is already included in the product price. This prevents customers and cashiers from seeing misleading tax details on receipts for these sales.
Original PR description
Currently, when buying a product with a division tax using price included the base price used to compute the total is not correct and will show a wrong total value. Steps to reproduce:…
Currently, when buying a product with a division tax using price included the base price used to compute the total is not correct and will show a wrong total value. Steps to reproduce: ------------------- * Go into the **Accounting** app * Under **Configuration** select **Taxes** * Create a new Tax * Tax Computation: `Percentage of Price Tax Included` * Amount 10% * Advenced Options > Included in price: `True` * Go to the **Point of sale** App * Create a new product. * Price: 200 * Tax: the one just created * Open shop session * Create an order with the new product and pay it > Observation: On the receipt, on the tax details, we can see: Tax: 10%, Amount: 20, Base: 200, Total: 220. This is not correct, the client paid 200 as tax is included in price. Why the fix: ------------ Currently the Base value on the receipt is given `taxValues.base`. The same quantity is also used for the computation of the Total shown. https://github.com/odoo/odoo/blob/49cecec35421cc36258f900d99c1040596601167/addons/point_of_sale/static/src/app/screens/receipt_screen/receipt/order_receipt.xml#L75-L76 However, if we look where the `taxValues` come from we see that they correspond to `tax_details` in `export_for_printing`. https://github.com/odoo/odoo/blob/49cecec35421cc36258f900d99c1040596601167/addons/point_of_sale/static/src/app/store/models.js#L1314 When checking the function `get_tax_details` we realize that `taxValues.base` actually refers to the `display_base` https://github.com/odoo/odoo/blob/49cecec35421cc36258f900d99c1040596601167/addons/point_of_sale/static/src/app/store/models.js#L2228 As disucssed with LAS, here is how the values on the receipt should be computed: ``` Amount = amount = 20 Base = display_base = 200 Total = base + amount = 180 + 20 ``` Technically, prior to the fix, here is how the value shown are computed: ``` Amount = amount = 20 Base = display_base = 200 Total = display_base + amount = 180 + 20 ``` This computation is problematic only in the setting explained earlier as this is the only one which will have a different value for `base` and `display_base`: https://github.com/odoo/odoo/blob/b8baa83e575a36dd539c9fda10d5ffbe3ef01183/addons/account/static/src/helpers/account_tax.js#L408-L411 Why do we write ```<span t-esc="props.formatCurrency(taxValues.display_base || taxValues.base, false)" />``` instead of just ```<span t-esc="props.formatCurrency(taxValues.display_base, false)" />``` with the changes currently applied in `get_Tax_details`? Well, when using the kiosk, information about the `display_base` does not exist in `_compute_tax_details`: https://github.com/odoo/odoo/blob/b8baa83e575a36dd539c9fda10d5ffbe3ef01183/addons/pos_self_order/models/pos_order.py#L41-L61 Thus we avoid an error when using the function `export_for_printing` by using `taxValues.base` as there is no `taxValues.display_base` provided. This is currently the only other time where the function `export_for_printing` sets the value sent for `tax_details`. opw-4032366