[imp] added warning when we try to exit the pos with pending changes
bzr revid: nicolas.vanhoren@openerp.com-20111213140732-kfu92k7wb6rcp9ie
This commit is contained in:
parent
0941028b44
commit
b5d844d2e6
|
@ -487,3 +487,7 @@
|
|||
background-color: #D92A2A;
|
||||
}
|
||||
|
||||
.point-of-sale .oe_pos-close-warning {
|
||||
height: 500px;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ openerp.point_of_sale = function(db) {
|
|||
return QWeb.render(template, ctx);
|
||||
};
|
||||
};
|
||||
var _t = db.web._t;
|
||||
|
||||
/*
|
||||
Local store access. Read once from localStorage upon construction and persist on every change.
|
||||
|
@ -1211,12 +1212,36 @@ openerp.point_of_sale = function(db) {
|
|||
});
|
||||
},
|
||||
changed_pending_operations: function () {
|
||||
var operations = pos.get('pending_operations');
|
||||
var number = operations.length;
|
||||
this.synch_notification.on_change_nbr_pending(number);
|
||||
this.synch_notification.on_change_nbr_pending(pos.get('pending_operations').length);
|
||||
},
|
||||
try_close: function() {
|
||||
this.close();
|
||||
pos.flush().then(_.bind(function() {
|
||||
var close = _.bind(this.close, this);
|
||||
if (pos.get('pending_operations').length > 0) {
|
||||
var confirm = false;
|
||||
$(QWeb.render('pos-close-warning')).dialog({
|
||||
resizable: false,
|
||||
height:160,
|
||||
modal: true,
|
||||
title: "Warning",
|
||||
buttons: {
|
||||
"Yes": function() {
|
||||
confirm = true;
|
||||
$( this ).dialog( "close" );
|
||||
},
|
||||
"No": function() {
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
},
|
||||
close: function() {
|
||||
if (confirm)
|
||||
close();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
}, this));
|
||||
},
|
||||
close: function() {
|
||||
this.stop();
|
||||
|
|
|
@ -130,6 +130,9 @@
|
|||
</a>
|
||||
</span>
|
||||
</t>
|
||||
<t t-name="pos-close-warning">
|
||||
<div>There are pending operations that could not be saved into the database, are you sure you want to exit?</div>
|
||||
</t>
|
||||
<t t-name="pos-category-template">
|
||||
<header>
|
||||
<ol class="breadcrumb">
|
||||
|
|
Loading…
Reference in New Issue