Skip to content

Commit

Permalink
[FIX] sale: company logo on portal
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
nim-odoo committed Dec 19, 2018
1 parent c6e6968 commit 5a0a480
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions addons/sale/controllers/portal.py
Expand Up @@ -168,6 +168,8 @@ def portal_order_page(self, order_id, report_type=None, access_token=None, messa
'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([
Expand Down

0 comments on commit 5a0a480

Please sign in to comment.