feat: auto-adjust positive cash differences and remove zero-amount payments during POS session validation.
This commit is contained in:
parent
37f2084860
commit
2aa917a4c7
@ -132,4 +132,22 @@ class PosSession(models.Model):
|
|||||||
"expected_amount": expected_total,
|
"expected_amount": expected_total,
|
||||||
"amount": expected_total,
|
"amount": expected_total,
|
||||||
})
|
})
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
def _validate_session(self, balancing_account=False, amount_to_balance=0, bank_payment_method_diffs=None):
|
||||||
|
for session in self:
|
||||||
|
if session.config_id.cash_control:
|
||||||
|
difference = session.cash_register_balance_end_real - session.cash_register_balance_end
|
||||||
|
if session.currency_id.compare_amounts(difference, 0.0) > 0:
|
||||||
|
session.message_post(body="Auto-adjustment: Cashier input %s overridden to expected %s to suppress positive difference of %s." % (
|
||||||
|
session.currency_id.format(session.cash_register_balance_end_real),
|
||||||
|
session.currency_id.format(session.cash_register_balance_end),
|
||||||
|
session.currency_id.format(difference)
|
||||||
|
))
|
||||||
|
session.write({'cash_register_balance_end_real': session.cash_register_balance_end})
|
||||||
|
|
||||||
|
for order in session.order_ids:
|
||||||
|
for payment in order.payment_ids:
|
||||||
|
if session.currency_id.is_zero(payment.amount):
|
||||||
|
payment.unlink()
|
||||||
|
return super(PosSession, self)._validate_session(balancing_account, amount_to_balance, bank_payment_method_diffs)
|
||||||
Loading…
Reference in New Issue
Block a user