summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbfr-o <bfr@odoo.com>2020-06-30 09:51:25 +0000
committerBenjamin Frantzen (bfr) <bfr@odoo.com>2020-07-03 15:53:29 +0000
commitd935f9b77e4f07f6745e88bc043b106b855ef002 (patch)
tree0a72040a84be1f430bbaa62b91c9cb9b7e810659
parentd4030f23863ea96a948bc4cd7781c80989b34ca4 (diff)
[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
-rw-r--r--addons/account_check_printing/models/account_payment.py2
1 files changed, 1 insertions, 1 deletions
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