[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)
This commit is contained in:
Damien Bouvy 2015-10-12 11:55:44 +02:00
parent 486cd33091
commit 156b33c89a
1 changed files with 3 additions and 1 deletions

View File

@ -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('<i class="fa fa-spinner fa-spin"></i> ');
$confirm_btn.attr('disabled', true);
openerp.jsonRpc("/quote/accept", 'call', {
'order_id': parseInt(order_id[1]),
'token': token,