[FIX] account: fix traceback when sending invoice without template
Create an invoice, click on send and print without an associated template. Traceback will occur because the lang parameter is set correctly only from a template. Adding a fallback in case there is no template setting opw-2168623 closes odoo/odoo#43008 X-original-commit: 8fd8fdcf0fa6fb26a1797ad2b40fcaf34d23eee2 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
@@ -2186,6 +2186,8 @@ class AccountMove(models.Model):
|
||||
lang = get_lang(self.env)
|
||||
if template and template.lang:
|
||||
lang = template._render_template(template.lang, 'account.move', self.id)
|
||||
else:
|
||||
lang = lang.code
|
||||
compose_form = self.env.ref('account.account_invoice_send_wizard_form', raise_if_not_found=False)
|
||||
ctx = dict(
|
||||
default_model='account.move',
|
||||
|
||||
Reference in New Issue
Block a user