diff --git a/fiscal_epos_print/static/src/js/epson_epos_print.js b/fiscal_epos_print/static/src/js/epson_epos_print.js index 8b5ad08c358..aa8a259cdf3 100644 --- a/fiscal_epos_print/static/src/js/epson_epos_print.js +++ b/fiscal_epos_print/static/src/js/epson_epos_print.js @@ -2,11 +2,9 @@ odoo.define("fiscal_epos_print.epson_epos_print", function (require) { "use strict"; var core = require("web.core"); - var utils = require("web.utils"); // Var PosDB = require('point_of_sale.DB'); // var rpc = require('web.rpc'); var _t = core._t; - var round_pr = utils.round_precision; const {Gui} = require("point_of_sale.Gui"); @@ -687,10 +685,7 @@ odoo.define("fiscal_epos_print.epson_epos_print", function (require) { xml += self.printRecItem({ description: l.product_name, quantity: l.quantity, - unitPrice: round_pr( - l.full_price, - self.sender.env.pos.currency.rounding - ), + unitPrice: l.full_price, department: l.tax_department.code, operator: fiscal_operator, }); @@ -699,10 +694,7 @@ odoo.define("fiscal_epos_print.epson_epos_print", function (require) { adjustmentType: 0, description: _t("Discount") + " " + l.discount + "%", - amount: round_pr( - l.quantity * l.full_price - l.price_display, - self.sender.env.pos.currency.rounding - ), + amount: l.quantity * l.full_price - l.price_display, operator: fiscal_operator, }); } @@ -711,10 +703,7 @@ odoo.define("fiscal_epos_print.epson_epos_print", function (require) { xml += self.printRecRefund({ description: _t("Refund: ") + l.product_name, quantity: l.quantity * -1.0, - unitPrice: round_pr( - l.price, - self.sender.env.pos.currency.rounding - ), + unitPrice: l.price, department: l.tax_department.code, operator: fiscal_operator, }); @@ -723,10 +712,7 @@ odoo.define("fiscal_epos_print.epson_epos_print", function (require) { // xml += self.printRecItem({ // description: _t("Refund cash"), // quantity: l.quantity, - // unitPrice: round_pr( - // l.price, - // self.sender.env.pos.currency.rounding - // ), + // unitPrice: l.price, // department: l.tax_department.code, // operator: fiscal_operator, // }); @@ -755,12 +741,7 @@ odoo.define("fiscal_epos_print.epson_epos_print", function (require) { } if (receipt.rounding_applied !== 0 && !has_refund) { xml += self.printRounding({ - amount: Math.abs( - round_pr( - receipt.rounding_applied, - self.sender.env.pos.currency.rounding - ) - ), + amount: Math.abs(receipt.rounding_applied), operator: fiscal_operator, }); xml += diff --git a/fiscal_epos_print/static/src/js/models.js b/fiscal_epos_print/static/src/js/models.js index fe22148d2f7..137898db86d 100644 --- a/fiscal_epos_print/static/src/js/models.js +++ b/fiscal_epos_print/static/src/js/models.js @@ -200,17 +200,9 @@ odoo.define("fiscal_epos_print.models", function (require) { if (receipt.tax_department.included_in_price === true) { receipt.full_price = this.price; } else { - // This strategy was used because JavaScript's Math.round rounds to the nearest integer - const dec_precision = this.pos.currency.decimal_places; - const full_price = Number( - ( - this.price * - (1 + receipt.tax_department.tax_amount / 100) - ).toFixed(dec_precision) + receipt.full_price = Number( + this.price * (1 + receipt.tax_department.tax_amount / 100) ); - const rounding_factor = Math.pow(10, dec_precision); - receipt.full_price = - Math.trunc(full_price * rounding_factor) / rounding_factor; } }