From eaec55346645397e586d859b1151dae2cd0fe857 Mon Sep 17 00:00:00 2001 From: Abdul Aziz Amrullah Date: Thu, 11 Jun 2026 16:38:44 +0700 Subject: [PATCH] Fix rounding value --- wizard/pos_export_bc_wizard.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/wizard/pos_export_bc_wizard.py b/wizard/pos_export_bc_wizard.py index 7e9e26a..509b63e 100644 --- a/wizard/pos_export_bc_wizard.py +++ b/wizard/pos_export_bc_wizard.py @@ -113,12 +113,13 @@ class PosExportBcWizard(models.TransientModel): subtotal = sum(l.price_subtotal for l in order.lines) discount_order = sum(abs(l.price_subtotal) for l in order.lines if l.price_unit < 0) tax = order.amount_tax - charge = order.amount_total paid = sum(p.amount for p in order.payment_ids if p.amount > 0) if paid == 0: continue + rounding = order.amount_paid - order.amount_total + charge = order.amount_paid pax = order.customer_count if 'customer_count' in order._fields else 1 - return_amt = order.amount_return if 'amount_return' in order._fields else (paid - charge if paid > charge else 0) + return_amt = order.amount_return if 'amount_return' in order._fields else (paid - order.amount_total if paid > order.amount_total else 0) payment_methods = ', '.join(order.payment_ids.mapped('payment_method_id.name')) note = order.note if 'note' in order._fields else '' @@ -174,7 +175,7 @@ class PosExportBcWizard(models.TransientModel): sheet.write(row_num, 14, tax, number_format) sheet.write(row_num, 15, 0, number_format) # Service if old_format: - sheet.write(row_num, 16, 0, number_format) # Rounding + sheet.write(row_num, 16, rounding, number_format) # Rounding sheet.write(row_num, 17, charge, number_format) sheet.write(row_num, 18, paid, number_format) sheet.write(row_num, 19, pax) @@ -187,7 +188,7 @@ class PosExportBcWizard(models.TransientModel): else: sheet.write(row_num, 16, 0, number_format) # Takeaway Charge sheet.write(row_num, 17, 0, number_format) # Packaging Fee - sheet.write(row_num, 18, 0, number_format) # Rounding + sheet.write(row_num, 18, rounding, number_format) # Rounding sheet.write(row_num, 19, charge, number_format) sheet.write(row_num, 20, paid, number_format) sheet.write(row_num, 21, pax)