Ich versuche eine Schaltfläche zum POS-Bildschirm hinzuzufügen. Viele der Informationen, die ich dafür habe, beziehen sich auf Odoo 8 und das ist wahrscheinlich der Grund, warum es nicht funktioniert. Ich habe das benutzerdefinierte Addon ohne Fehler installiert, aber ich sehe die Schaltfläche nicht. Ich bekomme auch keine Fehler, wenn ich den POS austrage. In Version 8 gibt es eine Datei, die widgets.jsOdoo 10 Button zu POS hinzufügen
module.PosWidget.include({
build_widgets: function(){
var self = this;
this._super()
Es enthält noch keine widgets.js in Version 10 und ich vermute, das ist, wo mein Problem ist. Es ist nur eine Vermutung, ich weiß wirklich nicht, wie man einen Knopf zum POS hinzufügt.
Hier ist meine 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`)
}
})
};
Mein /src/xml/pos_custom.xml
<?xml version="1.0" encoding="UTF-8"?>
<templates xml="template" xml:space="preserve">
<t t-name="custom_btn">
<button>Cust Button</button>
</t>
</templates>
mein /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>
manifest .py
{
'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,
}