Skip to content
Snippets Groups Projects
Commit d935f9b7 authored by bfr-o's avatar bfr-o Committed by Benjamin Frantzen (bfr)
Browse files

[FIX] account_check_printing: Fix xml_id not found in '_compute_check_amount_in_words'

When the model is loaded, the value of 'check_amount_in_words' is computed for each existing payment.
It could lead to a traceback if the second condition is reached referencing an xml_id that is not yet loaded.
Indeed, data are loaded after the models.

X-original-commit: a9234e7581f267c64c4bf19d93e7b6844fe4d0b4
parent d4030f23
Branches
Tags
No related merge requests found
......@@ -24,7 +24,7 @@ class AccountPayment(models.Model):
@api.depends('payment_method_id', 'currency_id', 'amount')
def _compute_check_amount_in_words(self):
for pay in self:
if pay.currency_id and pay.payment_method_id == self.env.ref('account_check_printing.account_payment_method_check'):
if pay.currency_id and pay.payment_method_id.code == 'check_printing':
pay.check_amount_in_words = pay.currency_id.amount_to_text(pay.amount)
else:
pay.check_amount_in_words = False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment