Skip to content

Commit

Permalink
[FIX][fiscal_epos_print] resolve round of line of price when the full…
Browse files Browse the repository at this point in the history
…_price is send to epson ref #3721
  • Loading branch information
matteoopenf authored and Borruso committed Jul 26, 2024
1 parent c53e6b4 commit 553e4f1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion fiscal_epos_print/static/src/js/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,17 @@ 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)
);
const rounding_factor = Math.pow(10, dec_precision);
receipt.full_price =
this.price * (1 + receipt.tax_department.tax_amount / 100);
Math.trunc(full_price * rounding_factor) / rounding_factor;
}
}

Expand Down

0 comments on commit 553e4f1

Please sign in to comment.