Fix rounding value
This commit is contained in:
parent
84dbd3a0f3
commit
eaec553466
@ -113,12 +113,13 @@ class PosExportBcWizard(models.TransientModel):
|
|||||||
subtotal = sum(l.price_subtotal for l in order.lines)
|
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)
|
discount_order = sum(abs(l.price_subtotal) for l in order.lines if l.price_unit < 0)
|
||||||
tax = order.amount_tax
|
tax = order.amount_tax
|
||||||
charge = order.amount_total
|
|
||||||
paid = sum(p.amount for p in order.payment_ids if p.amount > 0)
|
paid = sum(p.amount for p in order.payment_ids if p.amount > 0)
|
||||||
if paid == 0:
|
if paid == 0:
|
||||||
continue
|
continue
|
||||||
|
rounding = order.amount_paid - order.amount_total
|
||||||
|
charge = order.amount_paid
|
||||||
pax = order.customer_count if 'customer_count' in order._fields else 1
|
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'))
|
payment_methods = ', '.join(order.payment_ids.mapped('payment_method_id.name'))
|
||||||
note = order.note if 'note' in order._fields else ''
|
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, 14, tax, number_format)
|
||||||
sheet.write(row_num, 15, 0, number_format) # Service
|
sheet.write(row_num, 15, 0, number_format) # Service
|
||||||
if old_format:
|
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, 17, charge, number_format)
|
||||||
sheet.write(row_num, 18, paid, number_format)
|
sheet.write(row_num, 18, paid, number_format)
|
||||||
sheet.write(row_num, 19, pax)
|
sheet.write(row_num, 19, pax)
|
||||||
@ -187,7 +188,7 @@ class PosExportBcWizard(models.TransientModel):
|
|||||||
else:
|
else:
|
||||||
sheet.write(row_num, 16, 0, number_format) # Takeaway Charge
|
sheet.write(row_num, 16, 0, number_format) # Takeaway Charge
|
||||||
sheet.write(row_num, 17, 0, number_format) # Packaging Fee
|
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, 19, charge, number_format)
|
||||||
sheet.write(row_num, 20, paid, number_format)
|
sheet.write(row_num, 20, paid, number_format)
|
||||||
sheet.write(row_num, 21, pax)
|
sheet.write(row_num, 21, pax)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user