[FIX] account: check entry at posting
External addons (such as the POS) can create entries and end up bypassing the `_check_balanced` in the whole process. We force a check at posting, since at this point there is no reason to have an unbalanced entry anymore. opw-2168096 closes odoo/odoo#49489 X-original-commit: 88902e2d3953a311dfb3629daeebf22b8874b6e9 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
@@ -2307,6 +2307,10 @@ class AccountMove(models.Model):
|
||||
lambda m: m.is_invoice(include_receipts=True) and m.currency_id.is_zero(m.amount_total)
|
||||
).action_invoice_paid()
|
||||
|
||||
# Force balance check since nothing prevents another module to create an incorrect entry.
|
||||
# This is performed at the very end to avoid flushing fields before the whole processing.
|
||||
self._check_balanced()
|
||||
|
||||
def _auto_compute_invoice_reference(self):
|
||||
''' Hook to be overridden to set custom conditions for auto-computed invoice references.
|
||||
:return True if the move should get a auto-computed reference else False
|
||||
|
||||
Reference in New Issue
Block a user