我有一个自定义按钮,我希望它可以在POS odoo 11中进行验证之前呈现收据屏幕并打印账单。我尝试了很多,但是我不知道我需要做什么:(请帮助我。谢谢提前
这是我的js代码POS / static / src / js / pos.js
odoo.define('POS.pos', function (require) {
'use strict';
var models = require('point_of_sale.models');
var core = require('web.core');
var screens = require('point_of_sale.screens');
var Widget = require('web.Widget');
var ajax = require('web.ajax');
var QWeb = core.qweb;
var CustomButton = screens.PaymentScreenWidget.include({
renderElement: function() {
var self = this;
this._super();
this.$('.js_custom_print').click(function(){
self.click_custom_print();
});
},
click_custom_print: function(){
var order = this.pos.get_order();
var self = this;
console.log("order")
// I want here can render receipt screen and can print function
},
});
});
这是我的自定义按钮
<?xml version="1.0" encoding="utf-8"?>
<templates id="template" xml:space="preserve">
<t t-extend="PaymentScreenWidget">
<t t-jquery=".payment-buttons" t-operation="append">
<div class='button js_custom_print'>
<i class='fa fa-print' /> Custom Print
</div>
</t>
</t>
</templates>
请注意,我继承了POS odoo 11中的模板PaymentScreenWidget,并添加了自定义按钮以打印账单,然后转到“验证”。我努力地工作了4天:(而且我找不到解决该问题的方法:(请帮忙。非常感谢