diff --git a/addons/sale/data/mail_template_data.xml b/addons/sale/data/mail_template_data.xml index 5208b4698bf..72b2dae500c 100644 --- a/addons/sale/data/mail_template_data.xml +++ b/addons/sale/data/mail_template_data.xml @@ -16,10 +16,10 @@ Dear ${object.partner_id.name} % set access_action = object.with_context(force_website=True).get_access_action() -% set doc_name = 'quotation' if object.state in ('draft', 'sent') else 'order confirmation' % set is_online = access_action and access_action['type'] == 'ir.actions.act_url' +% set doc_name = 'quotation' if object.state in ('draft', 'sent') else 'order confirmation' % set access_name = is_online and object.template_id and 'Accept and pay %s online' % doc_name or 'View %s' % doc_name -% set access_url = is_online and access_action['url'] or '' +% set access_url = is_online and '/mail/view?model=sale.order&res_id=%d' % (object.id) or '' % if object.partner_id.parent_id: (${object.partner_id.parent_id.name}) diff --git a/addons/website_quote/models/sale_order.py b/addons/website_quote/models/sale_order.py index d84b6b6766b..1737b109f67 100644 --- a/addons/website_quote/models/sale_order.py +++ b/addons/website_quote/models/sale_order.py @@ -170,7 +170,7 @@ class SaleOrder(models.Model): def get_access_action(self): """ Instead of the classic form view, redirect to the online quote if it exists. """ self.ensure_one() - if not self.template_id: + if not self.template_id or (not self.env.user.share and not self.env.context.get('force_website')): return super(SaleOrder, self).get_access_action() return { 'type': 'ir.actions.act_url',