From 012eefcf3e773bc334cf5d019026bb0663b647b2 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 19 Dec 2018 14:08:17 +0000 Subject: [PATCH] [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 --- addons/sale/controllers/portal.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/sale/controllers/portal.py b/addons/sale/controllers/portal.py index 0796b65dead..d886ca173a0 100644 --- a/addons/sale/controllers/portal.py +++ b/addons/sale/controllers/portal.py @@ -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([