[IMP] Reportings Review
[odoo/odoo.git] / addons / pos_restaurant / static / src / js / printbill.js
1 function openerp_restaurant_printbill(instance,module){
2     var QWeb = instance.web.qweb;
3         var _t = instance.web._t;
4
5     module.PosWidget.include({
6         build_widgets: function(){
7             var self = this;
8             this._super();
9
10             if(this.pos.config.iface_printbill){
11                 var printbill = $(QWeb.render('PrintBillButton'));
12
13                 printbill.click(function(){
14                     var order = self.pos.get('selectedOrder');
15                     if(order.get('orderLines').models.length > 0){
16                         var receipt = order.export_for_printing();
17                         self.pos.proxy.print_receipt(QWeb.render('BillReceipt',{
18                             receipt: receipt, widget: self,
19                         }));
20                     }
21                 });
22
23                 printbill.appendTo(this.$('.control-buttons'));
24                 this.$('.control-buttons').removeClass('oe_hidden');
25             }
26         },
27     });
28 }