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 23, 2025
1 parent bd41c31 commit d75cb86
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 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 && !has_refund) {
let payment_round = 0;
if (receipt.total_paid < 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

0 comments on commit d75cb86

Please sign in to comment.