Skip to content

Commit

Permalink
[FIX] point_of_sale: Button spamming create duplicates
Browse files Browse the repository at this point in the history
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 odoo#23919
  • Loading branch information
Julien00859 authored and nim-odoo committed Oct 23, 2018
1 parent 22f0da8 commit 3008f7d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions addons/point_of_sale/static/src/js/screens.js
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand All @@ -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); });
});
},

Expand All @@ -1254,6 +1258,8 @@ var ClientListScreenWidget = ScreenWidget.extend({
// has created, and reload_partner() must have loaded the newly created partner.
self.display_client_details('hide');
}
}).always(function(){
$(".client-details-contents").on('click','.button.save',function(){ self.save_client_details(partner); });
});
},

Expand Down

0 comments on commit 3008f7d

Please sign in to comment.