[FIX] point_of_sale: prevent unbalanced error for invoicing cash orders
Before this commit, attempting to invoice an order paid by cash in a new session, with cash rounding enabled only for cash payments in the PoS config, would result in an unbalanced entries error. opw-3813932 closes odoo/odoo#158907 X-original-commit: 3a61e143af62f1edeec299a39ab133138ec0560c Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com> Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
This commit is contained in:
@@ -735,7 +735,7 @@ class PosOrder(models.Model):
|
||||
|
||||
# Cash rounding.
|
||||
cash_rounding = self.config_id.rounding_method
|
||||
if self.config_id.cash_rounding and cash_rounding and not self.config_id.only_round_cash_method:
|
||||
if self.config_id.cash_rounding and cash_rounding and (not self.config_id.only_round_cash_method or any(p.payment_method_id.is_cash_count for p in self.payment_ids)):
|
||||
amount_currency = cash_rounding.compute_difference(self.currency_id, total_amount_currency)
|
||||
if not self.currency_id.is_zero(amount_currency):
|
||||
balance = company_currency.round(amount_currency * rate)
|
||||
|
||||
Reference in New Issue
Block a user