[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
This commit is contained in:
committed by
Benjamin Frantzen (bfr)
parent
d4030f2386
commit
d935f9b77e
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user