[FIX] point_of_sale: correct compute prices of order in OrderManagementScreen
When viewing an order in the order management screen that has customer with fiscal position, the calculation of prices is based on the fiscal position of the currently active order. This commit fixes the issue by properly specifying the order in the calculation of taxes based on the order's customer and/or fiscal position. closes odoo/odoo#73396 X-original-commit: 889ab379e2e7533a4506be0e8d2badfe4c5c7f90 Related: odoo/enterprise#19509 Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
This commit is contained in:
@@ -2052,9 +2052,9 @@ exports.Orderline = Backbone.Model.extend({
|
||||
}
|
||||
return taxes;
|
||||
},
|
||||
_map_tax_fiscal_position: function(tax) {
|
||||
_map_tax_fiscal_position: function(tax, order = false) {
|
||||
var self = this;
|
||||
var current_order = this.pos.get_order();
|
||||
var current_order = order || this.pos.get_order();
|
||||
var order_fiscal_position = current_order && current_order.fiscal_position;
|
||||
var taxes = [];
|
||||
|
||||
@@ -2266,7 +2266,7 @@ exports.Orderline = Backbone.Model.extend({
|
||||
var tax = _.detect(taxes, function(t){
|
||||
return t.id === el;
|
||||
});
|
||||
product_taxes.push.apply(product_taxes, self._map_tax_fiscal_position(tax));
|
||||
product_taxes.push.apply(product_taxes, self._map_tax_fiscal_position(tax, self.order));
|
||||
});
|
||||
product_taxes = _.uniq(product_taxes, function(tax) { return tax.id; });
|
||||
|
||||
@@ -2297,7 +2297,7 @@ exports.Orderline = Backbone.Model.extend({
|
||||
var new_included_taxes = [];
|
||||
var self = this;
|
||||
_(taxes).each(function(tax) {
|
||||
var line_taxes = self._map_tax_fiscal_position(tax);
|
||||
var line_taxes = self._map_tax_fiscal_position(tax, order);
|
||||
if (line_taxes.length && line_taxes[0].price_include){
|
||||
new_included_taxes = new_included_taxes.concat(line_taxes);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user