[IMP] point_of_sale: confirmation message on session close when there are unposted orders
bzr revid: fva@openerp.com-20130919131228-hhrp3guno8ddt5m2
This commit is contained in:
@@ -668,7 +668,18 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
|
||||
var self = this;
|
||||
this._super();
|
||||
if(this.action){
|
||||
this.$el.click(function(){ self.action(); });
|
||||
this.$el.click(function(){
|
||||
var draft_order = _.find( self.pos.get('orders').models, function(order){
|
||||
return order.get('orderLines').length !== 0 && order.get('paymentLines').length === 0;
|
||||
});
|
||||
if(draft_order){
|
||||
if (confirm(_t("Pending orders will be lost.\nAre you sure you want to leave this session?"))) {
|
||||
self.action();
|
||||
}
|
||||
}else{
|
||||
self.action();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
show: function(){ this.$el.removeClass('oe_hidden'); },
|
||||
|
||||
Reference in New Issue
Block a user