[FIX] account_check_printing: Error when clearing the currency

Steps to reproduce the bug:
- Activate multi currencies on your user
- Let's consider currency A and currency B and currency A is the one set on your company
- Create a customer invoice I with currency B
- Go on the tree view of customer invoices and select I
- Click on "Action" and select "Generate an invoice"
- On the wizard, clear the currency B

Bug: A traceback was raised because the function amount_to_text requires a currency.

opw:1958888

closes odoo/odoo#32202

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2019-03-28 10:45:12 +00:00
parent 72932d7956
commit 6edd699ee9
@@ -28,7 +28,7 @@ class AccountRegisterPayments(models.TransientModel):
def _onchange_amount(self):
if hasattr(super(AccountRegisterPayments, self), '_onchange_amount'):
super(AccountRegisterPayments, self)._onchange_amount()
self.check_amount_in_words = self.currency_id.amount_to_text(self.amount)
self.check_amount_in_words = self.currency_id.amount_to_text(self.amount) if self.currency_id else False
def _prepare_payment_vals(self, invoices):
res = super(AccountRegisterPayments, self)._prepare_payment_vals(invoices)