[FIX] sale: company logo on portal

- Set a logo for Companies A & B
- Create a partner P in A
- Create a SO for P in B
- Send the SO by email
- In the email received, click on 'View Sales Order'

The logo displayed is the logo of Company A instead of Company B.

The logo is retrieved from `res_company` in the template:

https://github.com/odoo/odoo/blob/6be0cdef98fdafc2cb90042758de1b756e955624/addons/portal/views/portal_templates.xml#L31

However, `res_company` is set based on the company of the user:

https://github.com/odoo/odoo/blob/6be0cdef98fdafc2cb90042758de1b756e955624/odoo/addons/base/models/ir_ui_view.py#L1295

We make sure to set `res_company` based on the company of the order
instead. This works since the `values` have the priority over the
`qcontext`:

https://github.com/odoo/odoo/blob/fa9874915449896ff770adbb63780629c18b3e7b/odoo/addons/base/models/ir_ui_view.py#L1283

opw-1913665

closes odoo/odoo#29649
This commit is contained in:
Nicolas Martinelli
2018-12-19 14:18:13 +00:00
parent 231c466abf
commit 012eefcf3e
+2
View File
@@ -168,6 +168,8 @@ class CustomerPortal(CustomerPortal):
'partner_id': order_sudo.partner_id.id,
'report_type': 'html',
}
if order_sudo.company_id:
values['res_company'] = order_sudo.company_id
if order_sudo.has_to_be_paid():
domain = expression.AND([