From d935f9b77e4f07f6745e88bc043b106b855ef002 Mon Sep 17 00:00:00 2001 From: bfr-o Date: Tue, 30 Jun 2020 09:51:25 +0000 Subject: [PATCH] [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 --- addons/account_check_printing/models/account_payment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_check_printing/models/account_payment.py b/addons/account_check_printing/models/account_payment.py index 1034cf84ada..4a1fe600315 100644 --- a/addons/account_check_printing/models/account_payment.py +++ b/addons/account_check_printing/models/account_payment.py @@ -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