Skip to content

Commit

Permalink
[FIX] fiscal_epos_print: fix compute receipt.full_price
Browse files Browse the repository at this point in the history
  • Loading branch information
Borruso committed Jan 20, 2025
1 parent d751db4 commit 12f3478
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fiscal_epos_print/static/src/js/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +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
// This strategy was used because 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 =
Math.trunc(full_price * rounding_factor) / rounding_factor;
receipt.full_price = parseFloat(
full_price.toFixed(dec_precision)
);
}
}

Expand Down

0 comments on commit 12f3478

Please sign in to comment.