Skip to content

Commit

Permalink
[UPD] fiscal_epos_print: aggiornata PR OCA#3060
Browse files Browse the repository at this point in the history
  • Loading branch information
Borruso committed May 23, 2024
1 parent c396df9 commit 6a8a4b4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ odoo.define("fiscal_epos_print.PaymentScreen", function (require) {
var receipt = order.export_for_printing();
var fp90 = new eposDriver(printer_options, this);
await fp90.printFiscalReceipt(receipt);
await new Promise(resolve => setTimeout(resolve, 2500));
await new Promise((resolve) => setTimeout(resolve, 2000));
// This line causes problems on bill split. What's the sense of deleting the actual pos context?!
// It regenerates orders which are already partly paid using split function...
// this.env.pos.context = {};
Expand Down
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.decimals;
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 6a8a4b4

Please sign in to comment.