From 156b33c89ac421c8c6aa37eef5d8f183f883b886 Mon Sep 17 00:00:00 2001 From: Damien Bouvy Date: Mon, 12 Oct 2015 11:55:44 +0200 Subject: [PATCH] [IMP] website_quote: prevent double clicking on the confirm button Double clicking on the confirm button was actually possible and could confirm the orders multiple times (which could be problematic if some action are linked to the so confirmation) --- addons/website_quote/static/src/js/website_quotation.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/website_quote/static/src/js/website_quotation.js b/addons/website_quote/static/src/js/website_quotation.js index 8a1a3fcf739..d1193f015fd 100644 --- a/addons/website_quote/static/src/js/website_quotation.js +++ b/addons/website_quote/static/src/js/website_quotation.js @@ -42,12 +42,12 @@ website.if_dom_contains('div.o_website_quote', function () { $('form.js_accept_json').submit(function(ev){ ev.preventDefault(); var $link = $(ev.currentTarget); + var $confirm_btn = $link.find('button[type="submit"]'); var href = $link.attr("action"); var order_id = href.match(/accept\/([0-9]+)/); var token = href.match(/token=(.*)/); if (token) token = token[1]; - var signer_name = $("#name").val(); var sign = $("#signature").jSignature("getData",'image'); var is_empty = sign?empty_sign[1]==sign[1]:false; @@ -57,6 +57,8 @@ website.if_dom_contains('div.o_website_quote', function () { if (is_empty || ! signer_name) return false; + $confirm_btn.prepend(' '); + $confirm_btn.attr('disabled', true); openerp.jsonRpc("/quote/accept", 'call', { 'order_id': parseInt(order_id[1]), 'token': token,