i\'d like to print the template PosTicket before to pay it(preview of the ticket), I tried with the module \"pos_restaurant\" but doesn\'t work
Create a js using this code
/* Button Widget */
var PrintBillButtonTicket = screens.ActionButtonWidget.extend({
template: 'PrintBillButtonTicket',
print_xml: function(){
var order = this.pos.get('selectedOrder');
if(order.get_orderlines().length > 0){
var receipt = order.export_for_printing();
receipt.bill = true;
this.$('.pos-receipt-container').html(QWeb.render('PosTicket',{
widget:this,
order: order,
receipt: order.export_for_printing(),
orderlines: order.get_orderlines(),
paymentlines: order.get_paymentlines(),
}));
}
},
button_click: function(){
this.print_xml();
},
});
screens.define_action_button({
'name': 'print_billticket',
'widget': PrintBillButtonTicket,
});
Add XML File Below
<t t-name="PrintBillButtonTicket">
<span class="control-button order-printbillticket">
<i class="fa fa-print"></i>
Bill Print
</span>
</t>