[FIX] account: invoice report template for multi-company

Be in multi-company with companies C1, C2.
Let user U1 in company C1 create a vendor bill V.
Then U1 change to company C2.
Another user U2, in company C1, tries to print the vendor bill.
Traceback: Access error trying to access U1 to render the template

opw 2145738

closes odoo/odoo#41977

X-original-commit: 5b7b12c9907d7da03e08df4f5bac2198c3dc9cba
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
This commit is contained in:
Nans Lefebvre
2019-12-10 14:38:11 +00:00
parent bce6aa351b
commit c0ee3f423f
+2 -2
View File
@@ -218,7 +218,7 @@
<template id="report_invoice">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-set="lang" t-value="o.invoice_user_id.lang if o.type in ('in_invoice', 'in_refund') else o.partner_id.lang"/>
<t t-set="lang" t-value="o.invoice_user_id.sudo().lang if o.type in ('in_invoice', 'in_refund') else o.partner_id.lang"/>
<t t-call="account.report_invoice_document" t-lang="lang"/>
</t>
</t>
@@ -227,7 +227,7 @@
<template id="report_invoice_with_payments">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-set="lang" t-value="o.invoice_user_id.lang if o.type in ('in_invoice', 'in_refund') else o.partner_id.lang"/>
<t t-set="lang" t-value="o.invoice_user_id.sudo().lang if o.type in ('in_invoice', 'in_refund') else o.partner_id.lang"/>
<t t-call="account.report_invoice_document_with_payments" t-lang="lang"/>
</t>
</t>