|
@ -24,7 +24,7 @@ odoo.define('pos_order_mgmt.widgets', function (require) { |
|
|
return this._super(); |
|
|
return this._super(); |
|
|
} |
|
|
} |
|
|
var order = this.pos.reloaded_order; |
|
|
var order = this.pos.reloaded_order; |
|
|
this.$('.pos-receipt-container').html(QWeb.render('PosTicket', { |
|
|
|
|
|
|
|
|
this.$('.pos-receipt-container').html(QWeb.render('OrderReceipt', { |
|
|
widget: this, |
|
|
widget: this, |
|
|
pos: this.pos, |
|
|
pos: this.pos, |
|
|
order: order, |
|
|
order: order, |
|
@ -180,13 +180,13 @@ odoo.define('pos_order_mgmt.widgets', function (require) { |
|
|
|
|
|
|
|
|
if (this.pos.config.iface_print_via_proxy) { |
|
|
if (this.pos.config.iface_print_via_proxy) { |
|
|
this.pos.proxy.print_receipt(QWeb.render( |
|
|
this.pos.proxy.print_receipt(QWeb.render( |
|
|
'XmlReceipt', { |
|
|
|
|
|
receipt: order.export_for_printing(), |
|
|
|
|
|
|
|
|
'OrderReceipt', { |
|
|
widget: this, |
|
|
widget: this, |
|
|
pos: this.pos, |
|
|
pos: this.pos, |
|
|
order: order, |
|
|
order: order, |
|
|
|
|
|
receipt: order.export_for_printing(), |
|
|
orderlines: order.get_orderlines(), |
|
|
orderlines: order.get_orderlines(), |
|
|
paymentlines: order.get_paymentlines(), |
|
|
|
|
|
|
|
|
paymentlinesf: order.get_paymentlines(), |
|
|
})); |
|
|
})); |
|
|
this.pos.set_order(this.pos.current_order); |
|
|
this.pos.set_order(this.pos.current_order); |
|
|
this.pos.current_order = false; |
|
|
this.pos.current_order = false; |
|
@ -199,7 +199,9 @@ odoo.define('pos_order_mgmt.widgets', function (require) { |
|
|
// If it's invoiced, we also print the invoice
|
|
|
// If it's invoiced, we also print the invoice
|
|
|
if (order_data.to_invoice) { |
|
|
if (order_data.to_invoice) { |
|
|
this.pos.chrome.do_action('point_of_sale.pos_invoice_report', { |
|
|
this.pos.chrome.do_action('point_of_sale.pos_invoice_report', { |
|
|
additional_context: { active_ids: [order_data.id] } |
|
|
|
|
|
|
|
|
additional_context: { |
|
|
|
|
|
active_ids: [order_data.id] |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -279,18 +281,18 @@ odoo.define('pos_order_mgmt.widgets', function (require) { |
|
|
|
|
|
|
|
|
// Get Payment lines
|
|
|
// Get Payment lines
|
|
|
if (['print'].indexOf(action) !== -1) { |
|
|
if (['print'].indexOf(action) !== -1) { |
|
|
var paymentLines = order_data.statement_ids || []; |
|
|
|
|
|
|
|
|
var paymentLines = order_data.payment_lines || []; |
|
|
_.each(paymentLines, function(paymentLine) { |
|
|
_.each(paymentLines, function(paymentLine) { |
|
|
var line = paymentLine; |
|
|
var line = paymentLine; |
|
|
// In case of local data
|
|
|
// In case of local data
|
|
|
if (line.length === 3) { |
|
|
if (line.length === 3) { |
|
|
line = line[2]; |
|
|
line = line[2]; |
|
|
} |
|
|
} |
|
|
_.each(self.pos.cashregisters, function (cashregister) { |
|
|
|
|
|
if (cashregister.journal.id === line.journal_id) { |
|
|
|
|
|
|
|
|
_.each(self.pos.payment_methods, function(payment_method) { |
|
|
|
|
|
if (payment_method.id === line.payment_method_id) { |
|
|
if (line.amount > 0) { |
|
|
if (line.amount > 0) { |
|
|
// If it is not change
|
|
|
// If it is not change
|
|
|
order.add_paymentline(cashregister); |
|
|
|
|
|
|
|
|
order.add_paymentline(payment_method); |
|
|
order.selected_paymentline.set_amount( |
|
|
order.selected_paymentline.set_amount( |
|
|
line.amount); |
|
|
line.amount); |
|
|
} |
|
|
} |
|
@ -339,14 +341,15 @@ odoo.define('pos_order_mgmt.widgets', function (require) { |
|
|
model: 'pos.order', |
|
|
model: 'pos.order', |
|
|
method: 'load_done_order_for_pos', |
|
|
method: 'load_done_order_for_pos', |
|
|
args: [order_id], |
|
|
args: [order_id], |
|
|
}).fail(function (error) { |
|
|
|
|
|
if (parseInt(error.code, 10) === 200) { |
|
|
|
|
|
|
|
|
}).guardedCatch(function(reason) { |
|
|
|
|
|
if (parseInt(reason.message.code, 10) === 200) { |
|
|
// Business Logic Error, not a connection problem
|
|
|
// Business Logic Error, not a connection problem
|
|
|
self.gui.show_popup( |
|
|
self.gui.show_popup( |
|
|
'error-traceback', { |
|
|
'error-traceback', { |
|
|
'title': error.data.message, |
|
|
'title': error.data.message, |
|
|
'body': error.data.debug, |
|
|
'body': error.data.debug, |
|
|
}); |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
); |
|
|
} else { |
|
|
} else { |
|
|
self.gui.show_popup('error', { |
|
|
self.gui.show_popup('error', { |
|
|
'title': _t('Connection error'), |
|
|
'title': _t('Connection error'), |
|
@ -393,8 +396,8 @@ odoo.define('pos_order_mgmt.widgets', function (require) { |
|
|
.local().format('YYYY-MM-DD HH:mm:ss'); |
|
|
.local().format('YYYY-MM-DD HH:mm:ss'); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}).fail(function (error, event) { |
|
|
|
|
|
if (parseInt(error.code, 10) === 200) { |
|
|
|
|
|
|
|
|
}).guardedCatch(function(reason) { |
|
|
|
|
|
if (parseInt(reason.message.code, 10) === 200) { |
|
|
// Business Logic Error, not a connection problem
|
|
|
// Business Logic Error, not a connection problem
|
|
|
self.gui.show_popup( |
|
|
self.gui.show_popup( |
|
|
'error-traceback', { |
|
|
'error-traceback', { |
|
@ -410,14 +413,14 @@ odoo.define('pos_order_mgmt.widgets', function (require) { |
|
|
' is currently offline'), |
|
|
' is currently offline'), |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
event.preventDefault(); |
|
|
|
|
|
|
|
|
reason.event.preventDefault(); |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
perform_search: function() { |
|
|
perform_search: function() { |
|
|
var self = this; |
|
|
var self = this; |
|
|
return this.search_done_orders(self.search_query) |
|
|
return this.search_done_orders(self.search_query) |
|
|
.done(function () { |
|
|
|
|
|
|
|
|
.then(function() { |
|
|
self.render_list(); |
|
|
self.render_list(); |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|