如何在Odoo11中向POS屏幕添加按钮?

如何在Odoo11中向POS屏幕添加按钮?,odoo,Odoo,我正在尝试向POS屏幕添加一个按钮。我有很多关于奥多11 CE的信息,这可能就是它不起作用的原因。我安装的自定义插件没有任何错误,但我没有看到按钮。我在运行POS时也没有收到任何错误。在版本11中有一个widgets.js文件,其中包括 module.PosWidget.include({ build_widgets: function(){ var self = this; this._super() 版本11中没有widgets.js,我猜这就是我的问题

我正在尝试向POS屏幕添加一个按钮。我有很多关于奥多11 CE的信息,这可能就是它不起作用的原因。我安装的自定义插件没有任何错误,但我没有看到按钮。我在运行POS时也没有收到任何错误。在版本11中有一个widgets.js文件,其中包括

module.PosWidget.include({
      build_widgets: function(){
      var self = this;
      this._super()
版本11中没有widgets.js,我猜这就是我的问题所在。这只是一个猜测,我真的不知道如何添加一个按钮的POS机

这是我的pos_custom.js

odoo.pos_custom = function(instance){
    var module = instance.point_of_sale;
    var round_pr = instance.web.round_precision
    var QWeb = instance.web.qweb;

console.log("POS JS Loaded")
module.PosWidget.include({
    build_widgets: function(){
  var self = this;
  this._super()

   custom_btn = $(QWeb.render(`custom_btn`))
   custom_btn.click(function(){
        alert("hello")
   })
   console.log("button <<<>>> ",custom_btn,this.$(`.control-button`))
   custom_btn.appendTo(this.$(`.control-button`))


  this.$control_buttons`).removeClass(`oe_hidden`)


        }
/自定义按钮/清单.py

/自定义按钮/views/templates.xml

<?xml version="1.0"?>
<openerp>
  <data>
    <template id="assets_backend" name="pos_custom assets" 
inherit_id="web.assets_backend">
        <xpath expr="." position="inside">

            <script type="text/javascript" 
src="/pos_custom/static/src/js/pos_custom.js"></script>
            </xpath>
        </template>

   </data>
 </openerp>

<?xml version="1.0"?>
<openerp>
  <data>
    <template id="assets_backend" name="pos_custom assets" 
inherit_id="web.assets_backend">
        <xpath expr="." position="inside">

            <script type="text/javascript" 
src="/pos_custom/static/src/js/pos_custom.js"></script>
            </xpath>
        </template>

   </data>
 </openerp>
{
'name': 'Point Custom Module',
'version': '1.2',
'category': 'Point of Sale',
'summary': 'Custom Point of Sale ',
'description': "",
'data': [
    "views/templates.xml"

],
'depends': ['point_of_sale'],


'qweb': ['static/src/xml/*.xml'],
'application': True,


}
{
    'name': 'CustomButton',
    'summary': '',
    'version': '1.0',

    'description': """

    """,

    # 'author': '',
    # 'maintainer': '',
    # 'contributors': [''],

    # 'website': '',

    'license': 'AGPL-3',
    'category': 'Uncategorized',

    'depends': [
        'base', 'point_of_sale',
    ],
    'external_dependencies': {
        'python': [
        ],
    },
    'data': [
        'views/templates.xml',

    ],
    'demo': [
    ],
    'js': [
    ],
    'css': [
    ],
    'qweb': [
    'static/src/xml/custom_button.xml',
    ],
    'images': [
    ],
    'test': [
    ],

    'installable': True
}
<?xml version="1.0" encoding="utf-8"?>
<odoo>

    <template id="assets" inherit_id="point_of_sale.assets">
        <xpath expr="." position="inside">

            <script type="text/javascript" src="/custom-button/static/src/js/custom.js"></script>

        </xpath>

    </template>

</odoo>
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
    <t t-name="CustomButton">
        <span class="control-button">
            <i class="fa fa-print"></i>
            Custom Button
        </span>
    </t>

</templates>
odoo.define('custom-button.custom_button', function (require) {
"use strict";
var core = require('web.core');
var screens = require('point_of_sale.screens');
var gui = require('point_of_sale.gui');





//Custom Code
var CustomButton = screens.ActionButtonWidget.extend({
    template: 'CustomButton',

    button_click: function(){

    var self = this;
    self.custom_function();

    },

    custom_function: function(){
        console.log('Hi I am button click of CustomButton');
    }

});

screens.define_action_button({
    'name': 'custom_button',
    'widget': CustomButton,
});




});