Skip to content
Permalink
Browse files

[FIX] point_of_sale: list price display after tax mapping

- In general settings:
    - Sales:
        - Activate discount
        - Activate Multiple Sale Prices with option computed from formula
    - Point of sale:
        - Activate Multiple Sale Prices with option computed from formula
    - Accounting:
        - Set show price tax-included
- Modify the Public Pricelist: Set to Global, price discount 50%
- Modify the sale tax to be included in price
- Create a 0% tax included in price
- Open fiscal position: Set auto-detect, replace sale 15% by 0%
- Open a product and set customer tax to sale 15%
- Open POS session configuration
    - Set fiscal position, tax included in price and public pricelist
- Add product "Pedal Bin"

You will see in strikethough text the original selling price with tax included,
while taxes should have been removed from the tax mapping.
Note that this is purely aesthetical, the total amount calculated is correct.
Fixing by calculating the price from the original selling price.

opw-2155779

closes #43112

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
  • Loading branch information
agr-odoo committed Jan 10, 2020
1 parent 9c37a29 commit 5ee893f6c0543eec7303f010cc6065a31bc4fb0e
Showing with 25 additions and 21 deletions.
  1. +23 −19 addons/point_of_sale/static/src/js/models.js
  2. +2 −2 addons/point_of_sale/static/src/xml/pos.xml
@@ -1947,6 +1947,28 @@ exports.Orderline = Backbone.Model.extend({
display_discount_policy: function(){
return this.order.pricelist.discount_policy;
},
compute_fixed_price: function (price) {
var order = this.order;
if(order.fiscal_position) {
var taxes = this.get_taxes();
var mapped_included_taxes = [];
var self = this;
_(taxes).each(function(tax) {
var line_taxes = self._map_tax_fiscal_position(tax);
if(tax.price_include && !_.contains(line_taxes, tax)){
mapped_included_taxes.push(tax);
}
});

if (mapped_included_taxes.length > 0) {
return this.compute_all(mapped_included_taxes, price, 1, order.pos.currency.rounding, true).total_excluded;
}
}
return price;
},
get_fixed_lst_price: function(){
return this.compute_fixed_price(this.get_lst_price());
},
get_lst_price: function(){
return this.product.lst_price;
},
@@ -2460,25 +2482,7 @@ exports.Order = Backbone.Model.extend({
},

fix_tax_included_price: function(line){
if(this.fiscal_position){
var unit_price = line.price;
var taxes = line.get_taxes();
var mapped_included_taxes = [];
_(taxes).each(function(tax) {
var line_taxes = line._map_tax_fiscal_position(tax);
if(tax.price_include && !_.contains(line_taxes, tax)){

mapped_included_taxes.push(tax);
}
});

if (mapped_included_taxes.length > 0) {
unit_price = line.compute_all(mapped_included_taxes, unit_price, 1, this.pos.currency.rounding, true).total_excluded;
}

line.set_unit_price(unit_price);
}

line.set_unit_price(line.compute_fixed_price(line.price));
},

add_product: function(product, options){
@@ -1327,7 +1327,7 @@
<t t-if="line.display_discount_policy() == 'without_discount' &amp;&amp;
line.get_unit_display_price() != line.get_lst_price()">
<s>
<t t-esc="widget.format_currency(line.get_lst_price(),'Product Price')" />
<t t-esc="widget.format_currency(line.get_fixed_lst_price(),'Product Price')" />
</s>
<t t-esc="widget.format_currency(line.get_unit_display_price(),'Product Price')" />
</t>
@@ -1525,7 +1525,7 @@
orderline.get_unit_display_price() != orderline.get_lst_price()">
<div class="pos-disc-font">
<s>
<t t-esc="widget.format_currency(orderline.get_lst_price(),'Product Price')"/>
<t t-esc="widget.format_currency(orderline.get_fixed_lst_price(),'Product Price')"/>
</s> ->
<t t-esc="widget.format_currency(orderline.get_unit_display_price(),'Product Price')"/>
</div>

0 comments on commit 5ee893f

Please sign in to comment.
You can’t perform that action at this time.