summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Lempereur <nle@odoo.com>2016-01-29 11:26:13 +0100
committerNicolas Lempereur <nle@odoo.com>2016-01-29 12:08:24 +0100
commitf5fedbcb18a57ee9aeab952f3ff95f692f7a863c (patch)
tree5e560944425ccb8ebbed5fd5d1afa512b97224b9
parent1414d60b7b5856ed1c0cdced0218371d662154f5 (diff)
[FIX] mail, portal_sale: conserve action in /mail/view
Methods get_formview_action can be called by sudo() so for knowing the real user they should prefer context['uid'] to uid. Without the action `/web` can't figure out that e.g the view we want is the one for portal user and not the default one. With this fix, portal user (not in base.group_user) get to the intended view with the intended menu when clicking on a invoice/sale order portal mail link. As for other user there is no change. closes #10681 opw-666260
-rw-r--r--addons/mail/controllers/main.py1
-rw-r--r--addons/portal_sale/portal_sale.py6
2 files changed, 5 insertions, 2 deletions
diff --git a/addons/mail/controllers/main.py b/addons/mail/controllers/main.py
index de6f0a63487..74ffbc07ca9 100644
--- a/addons/mail/controllers/main.py
+++ b/addons/mail/controllers/main.py
@@ -143,6 +143,7 @@ class MailController(http.Controller):
'id': res_id,
'active_id': res_id,
'view_id': record_sudo.get_formview_id(),
+ 'action': record_action.get('id'),
}
url = '/web?%s#%s' % (url_encode(query), url_encode(url_params))
return werkzeug.utils.redirect(url)
diff --git a/addons/portal_sale/portal_sale.py b/addons/portal_sale/portal_sale.py
index 7cdc783769b..0969eb8cc69 100644
--- a/addons/portal_sale/portal_sale.py
+++ b/addons/portal_sale/portal_sale.py
@@ -41,7 +41,8 @@ class sale_order(osv.Model):
)[document.partner_id.id]
def get_formview_action(self, cr, uid, id, context=None):
- user = self.pool['res.users'].browse(cr, SUPERUSER_ID, uid, context=context)
+ context = context or {}
+ user = self.pool['res.users'].browse(cr, SUPERUSER_ID, context.get('uid', uid), context=context)
if user.share:
document = self.browse(cr, uid, id, context=context)
action_xmlid = 'action_quotations_portal' if document.state in ('draft', 'sent') else 'action_orders_portal'
@@ -83,7 +84,8 @@ class account_invoice(osv.Model):
)[document.partner_id.id]
def get_formview_action(self, cr, uid, id, context=None):
- user = self.pool['res.users'].browse(cr, SUPERUSER_ID, uid, context=context)
+ context = context or {}
+ user = self.pool['res.users'].browse(cr, SUPERUSER_ID, context.get('uid', uid), context=context)
if user.share:
return self.pool['ir.actions.act_window'].for_xml_id(cr, uid, 'portal_sale', 'portal_action_invoices', context=context)
return super(account_invoice, self).get_formview_action(cr, uid, id, context=context)