diff --git a/addons/website_quote/controllers/main.py b/addons/website_quote/controllers/main.py index 2eeb3c4a645..bc42deb42a9 100644 --- a/addons/website_quote/controllers/main.py +++ b/addons/website_quote/controllers/main.py @@ -64,6 +64,8 @@ class sale_quote(http.Controller): order = order_obj.browse(request.cr, SUPERUSER_ID, order_id) if token != order.access_token: return request.website.render('website.404') + if order.state != 'sent': + return False attachments=sign and [('signature.png', sign.decode('base64'))] or [] order_obj.signal_workflow(request.cr, SUPERUSER_ID, [order_id], 'order_confirm', context=request.context) message = _('Order signed by %s') % (signer,) @@ -76,6 +78,8 @@ class sale_quote(http.Controller): order = order_obj.browse(request.cr, SUPERUSER_ID, order_id) if token != order.access_token: return request.website.render('website.404') + if order.state != 'sent': + return werkzeug.utils.redirect("/quote/%s/%s?message=4" % (order_id, token)) request.registry.get('sale.order').action_cancel(request.cr, SUPERUSER_ID, [order_id]) message = post.get('decline_message') if message: diff --git a/addons/website_quote/static/src/js/website_quotation.js b/addons/website_quote/static/src/js/website_quotation.js index 37f5e2a9a62..8a1a3fcf739 100644 --- a/addons/website_quote/static/src/js/website_quotation.js +++ b/addons/website_quote/static/src/js/website_quotation.js @@ -63,8 +63,9 @@ website.if_dom_contains('div.o_website_quote', function () { 'signer': signer_name, 'sign': sign?JSON.stringify(sign[1]):false, }).then(function (data) { + var message_id = (data) ? 3 : 4; $('#modelaccept').modal('hide'); - window.location.href = '/quote/'+order_id[1]+'/'+token+'?message=3'; + window.location.href = '/quote/'+order_id[1]+'/'+token+'?message='+message_id; }); return false; }); diff --git a/addons/website_quote/views/website_quotation.xml b/addons/website_quote/views/website_quotation.xml index 2d64735d756..b8efd0c946d 100644 --- a/addons/website_quote/views/website_quotation.xml +++ b/addons/website_quote/views/website_quotation.xml @@ -252,6 +252,14 @@ and do not hesitate to contact us for any question. +
+ + This order has already been + cancelled + validated + ! You can contact us for + any question. +

Your Quotation