Permalink
Browse files

[Fix] point_of_sale: Button spamming create duplicates

Spamming the save button when creating a new custommer in point-
of-sale create duplicate users. This PR disable the button once
clicked and re-enable it when all the processing is done.

opw-1895302

close #23919
  • Loading branch information...
Julien00859 committed Oct 17, 2018
1 parent 956b3ce commit 38893b34f2b5f024f5077504c99a4a1750ca5057
Showing with 5 additions and 0 deletions.
  1. +5 −0 addons/point_of_sale/static/src/js/screens.js
@@ -1224,6 +1224,9 @@ var ClientListScreenWidget = ScreenWidget.extend({
fields.id = partner.id || false;
fields.country_id = fields.country_id || false;
var contents = this.$(".client-details-contents");
contents.off("click", ".button.save");
new Model('res.partner').call('create_from_ui',[fields]).then(function(partner_id){
self.saved_client_details(partner_id);
},function(err,event){
@@ -1237,6 +1240,7 @@ var ClientListScreenWidget = ScreenWidget.extend({
'title': _t('Error: Could not Save Changes'),
'body': error_body,
});
contents.on('click','.button.save',function(){ self.save_client_details(partner); });
});
},
@@ -1254,6 +1258,7 @@ var ClientListScreenWidget = ScreenWidget.extend({
// has created, and reload_partner() must have loaded the newly created partner.
self.display_client_details('hide');
}
$(".client-details-contents").on('click','.button.save',function(){ self.save_client_details(partner); });
});
},

0 comments on commit 38893b3

Please sign in to comment.