在pos Odoo-8创建收据

时间:2018-04-10 16:41:41

标签: javascript odoo-8

我想在支付之前打印模板 PosTicket (预览票证),我尝试使用模块“pos_restaurant”但不起作用, 有什么建议?。谢谢。

1 个答案:

答案 0 :(得分:1)

使用此代码创建js

/ *按钮小工具* /

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,

});

在下面添加XML文件

<t t-name="PrintBillButtonTicket">
        <span class="control-button order-printbillticket">
            <i class="fa fa-print"></i>
            Bill Print
        </span>
    </t>