summaryrefslogtreecommitdiff
path: root/addons/website_quote/controllers/main.py
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2017-08-28 13:54:52 +0200
committerThibault Delavallée <tde@odoo.com>2017-09-06 10:40:22 +0200
commit22734f47d8a84d08c7f62ff2ca0f4241134bc9b6 (patch)
tree127eed747d9e9c5d66c18ae5954fe3c6d589af90 /addons/website_quote/controllers/main.py
parent071451a884e0f0dbe1e7199c31c51df8b24bd6d8 (diff)
[IMP] website_quote: improve quote url management in customer portal
* website_quote should not override all sale links from the customer portal to replace them by website_quote specific view. Indeed the quote view should be used only if the order has an active template defined on it; * do not override existing columns of the order page view on portal with same content; * implement redirection at route level by overriding the controller order route;
Diffstat (limited to 'addons/website_quote/controllers/main.py')
-rw-r--r--addons/website_quote/controllers/main.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/addons/website_quote/controllers/main.py b/addons/website_quote/controllers/main.py
index 859eb5f715c..f8c67177304 100644
--- a/addons/website_quote/controllers/main.py
+++ b/addons/website_quote/controllers/main.py
@@ -4,13 +4,28 @@ import base64
import werkzeug
-from odoo import fields, http, _
+from odoo import exceptions, fields, http, _
from odoo.http import request
-from odoo.addons.portal.controllers.portal import get_records_pager
+from odoo.addons.portal.controllers.portal import CustomerPortal, get_records_pager
from odoo.addons.portal.controllers.mail import _message_post_helper
+class CustomerPortal(CustomerPortal):
+
+ @http.route()
+ def portal_order_page(self, order=None, access_token=None, **kw):
+ try:
+ order_sudo = self._order_check_access(order, access_token=access_token)
+ except exceptions.AccessError:
+ pass
+ else:
+ if order_sudo.template_id and order_sudo.template_id.active:
+ return request.redirect('/quote/%s/%s' % (order, access_token or ''))
+ return super(CustomerPortal, self).portal_order_page(order=order, access_token=access_token, **kw)
+
+
class sale_quote(http.Controller):
+
@http.route("/quote/<int:order_id>", type='http', auth="user", website=True)
def view_user(self, *args, **kwargs):
return self.view(*args, **kwargs)