I have this XML file for my custom button in POS
<?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>
And js file is in 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 PrintBillButtonTicket = screens.ActionButtonWidget.extend({
template: 'PaymentScreenWidget',
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': PaymentScreenWidget,
});
});I have error that some module could not be started POS.pos? How can i fixed this to run my function print_xml for my custom button
Show the error log, and the external id you are inheriting. Are you inheriting point_of_sale.assets (<template id="assets" inherit_id="point_of_sale.assets">) to include your js file?