diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 97c4685ea52..580e033e8f3 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -807,11 +807,20 @@ class account_invoice(models.Model): ctx = dict(self._context, lang=inv.partner_id.lang) + company_currency = inv.company_id.currency_id if not inv.date_invoice: + # FORWARD-PORT UP TO SAAS-6 + if inv.currency_id != company_currency and inv.tax_line: + raise except_orm( + _('Warning!'), + _('No invoice date!' + '\nThe invoice currency is not the same than the company currency.' + ' An invoice date is required to determine the exchange rate to apply. Do not forget to update the taxes!' + ) + ) inv.with_context(ctx).write({'date_invoice': fields.Date.context_today(self)}) date_invoice = inv.date_invoice - company_currency = inv.company_id.currency_id # create the analytical lines, one move line per invoice line iml = inv._get_analytic_lines() # check if taxes are all computed