I want to add new button in the point of sale interface and also want to call a python function from that button. I tried to inherit screens.js file in the point of sale module. But didnt work. I posted my module structure below.
pos_button
__init__.py
__openerp__.py
views
pos_button.xml
static
src
js
img
Code
pos_button.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Inherit the js template in the module and include js file there. -->
<template id="assets_backend" name="pos_print" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/pos_button/static/src/js/pos_button.js"></script>
</xpath>
</template>
</data>
</openerp>
{
'name': 'POS Print',
'category': 'Hidden',
'version': '1.0',
'author': 'Exuberant Services & Solutions',
'description':
"""
Add new print button in POS
========================
This module provides the color change of the main menu.
""",
'depends' : [
'web','point_of_sale'
],
'auto_install': True,
'data': [
'views/pos_button.xml'
],
'js' : [
'static/src/js/pos_button.js',
],
}
pos_button.js
module.ReceiptScreenWidget = module.ScreenWidget.extend({
template: 'ReceiptScreenWidget',
show_numpad: true,
show_leftpane: true,
init: function(parent, options) {
this._super(parent,options);
this.model = options.model;
this.user = this.pos.get('user');
this.company = this.pos.get('company');
this.shop_obj = this.pos.get('shop');
},
renderElement: function() {
this._super();
this.pos.bind('change:selectedOrder', this.change_selected_order, this);
this.change_selected_order();
},
show: function(){
this._super();
var self = this;
this.add_action_button({
label: _t('Print Receipt'),
icon: '/pos_print/static/src/img/icons/printer.png',
click: function(){ self.print(); },
});
},