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

X-original-commit: 7de221c
  • Loading branch information
agr-odoo committed Jan 10, 2020
1 parent 6206e0e commit 1030bea29babfbe7ac447523aecf89cf7ea3bde5
Showing with 24 additions and 20 deletions.
  1. +23 −19 addons/point_of_sale/static/src/js/models.js
  2. +1 −1 addons/point_of_sale/static/src/xml/pos.xml
@@ -2040,6 +2040,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;
},
@@ -2623,25 +2645,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){
@@ -1473,7 +1473,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>

0 comments on commit 1030bea

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