Skip to content

Commit

Permalink
Added rounding with payment type 6
Browse files Browse the repository at this point in the history
  • Loading branch information
Wvven committed Jan 28, 2025
1 parent f4d6438 commit 81ce1fd
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions fiscal_epos_print/static/src/js/epson_epos_print.js
Original file line number Diff line number Diff line change
Expand Up @@ -711,21 +711,23 @@ odoo.define("fiscal_epos_print.epson_epos_print", function (require) {
receipt.lottery_code.padEnd(16, " ") +
'0000" />';
}
if (receipt.rounding_applied !== 0 && !has_refund) {
xml += self.printRounding({
amount: Math.abs(
round_pr(
receipt.rounding_applied,
self.sender.env.pos.currency.rounding
)
),
operator: fiscal_operator,
});
xml +=
'<printRecSubtotal operator="' +
fiscal_operator +
'" option="1" />';

//Check for roundings Payments
//If it's needed, adds a payment line with payment method type 6 in case of a rounding
if (receipt.subtotal != receipt.total_paid) {
let payment_round = 0;
if (Math.abs(receipt.total_paid) < Math.abs(receipt.subtotal)) {
payment_round = round_pr(
(receipt.subtotal - receipt.total_paid), self.sender.env.pos.currency.rounding
);
xml += this.printRecTotal({
payment: Math.abs(payment_round),
paymentType: "6",
operator: fiscal_operator,
});
}
}

// TODO is always the same Total for refund and payments?
receipt.ticket = "";
_.each(receipt.paymentlines, function (l) {
Expand Down Expand Up @@ -763,9 +765,6 @@ odoo.define("fiscal_epos_print.epson_epos_print", function (require) {
console.log(xml);
},

/*
DON'T USE, this fiscal closure is forbid by Epson by default
*/
printFiscalReport: function (f_op) {
var xml = "<printerFiscalReport>";
xml += '<printZReport operator="' + f_op + '" timeout="" />';
Expand Down

0 comments on commit 81ce1fd

Please sign in to comment.