|
@@ -33,23 +33,6 @@ openerp.eiru_ticket_bill_kitchen = function (instance) {
|
|
this.print();
|
|
this.print();
|
|
}
|
|
}
|
|
|
|
|
|
- //
|
|
|
|
- // The problem is that in chrome the print() is asynchronous and doesn't
|
|
|
|
- // execute until all rpc are finished. So it conflicts with the rpc used
|
|
|
|
- // to send the orders to the backend, and the user is able to go to the next
|
|
|
|
- // screen before the printing dialog is opened. The problem is that what's
|
|
|
|
- // printed is whatever is in the page when the dialog is opened and not when it's called,
|
|
|
|
- // and so you end up printing the product list instead of the receipt...
|
|
|
|
- //
|
|
|
|
- // Fixing this would need a re-architecturing
|
|
|
|
- // of the code to postpone sending of orders after printing.
|
|
|
|
- //
|
|
|
|
- // But since the print dialog also blocks the other asynchronous calls, the
|
|
|
|
- // button enabling in the setTimeout() is blocked until the printing dialog is
|
|
|
|
- // closed. But the timeout has to be big enough or else it doesn't work
|
|
|
|
- // 2 seconds is the same as the default timeout for sending orders and so the dialog
|
|
|
|
- // should have appeared before the timeout... so yeah that's not ultra reliable.
|
|
|
|
-
|
|
|
|
finish_button.set_disabled(true);
|
|
finish_button.set_disabled(true);
|
|
setTimeout(function(){
|
|
setTimeout(function(){
|
|
finish_button.set_disabled(false);
|
|
finish_button.set_disabled(false);
|
|
@@ -67,18 +50,21 @@ openerp.eiru_ticket_bill_kitchen = function (instance) {
|
|
var order = this.pos.get('selectedOrder');
|
|
var order = this.pos.get('selectedOrder');
|
|
var categories = this.pos.printers[0].config.product_categories_ids;
|
|
var categories = this.pos.printers[0].config.product_categories_ids;
|
|
var orderlines = order.get('orderLines').models;
|
|
var orderlines = order.get('orderLines').models;
|
|
|
|
+
|
|
_.each(orderlines, function(item){
|
|
_.each(orderlines, function(item){
|
|
for (var i = 0; i < categories.length; i++) {
|
|
for (var i = 0; i < categories.length; i++) {
|
|
if(item.product.pos_categ_id[0] == categories[i]){
|
|
if(item.product.pos_categ_id[0] == categories[i]){
|
|
data.push({
|
|
data.push({
|
|
product_id: item.product.id,
|
|
product_id: item.product.id,
|
|
product_name: item.product.display_name,
|
|
product_name: item.product.display_name,
|
|
- product_description: item.product.description,
|
|
|
|
|
|
+ product_pack_lines: item.pack_lines,
|
|
product_qty: ' --> ' + item.quantity,
|
|
product_qty: ' --> ' + item.quantity,
|
|
|
|
+ line_id: item.id,
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+
|
|
$('.pos-receipt-container', this.$el).html(QWeb.render('PosTicket',{
|
|
$('.pos-receipt-container', this.$el).html(QWeb.render('PosTicket',{
|
|
widget:this,
|
|
widget:this,
|
|
order: order,
|
|
order: order,
|