[MERGE] point_of_sale: selected fixes from the trunk_review_pos branch

bzr revid: fva@openerp.com-20130919142051-5vo1md2a7t6hyptf
This commit is contained in:
Frédéric van der Essen
2013-09-19 16:20:51 +02:00
4 changed files with 21 additions and 2 deletions
File diff suppressed because one or more lines are too long
@@ -883,6 +883,11 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
label: _t('Back'),
icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png',
click: function(){
_.each(self.paymentlinewidgets, function(widget){
if( widget.payment_line.get_amount() === 0 ){
widget.payment_line.destroy();
}
});
self.pos_widget.screen_selector.set_current_screen(self.back_screen);
},
});
+12 -1
View File
@@ -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'); },
@@ -15,7 +15,7 @@
<field name="pos_state" invisible="1" />
</group>
<field name="pos_session_id" invisible="1"/>
<button name="open_ui" type="object" string="Start Selling"
<button name="open_ui" type="object" string="Resume Session"
attrs="{'invisible' : [('pos_state', 'not in', ('opened',))]}"
class="oe_highlight"
/>