提问人:Huy Trần 提问时间:10/19/2023 最后编辑:KenlyHuy Trần 更新时间:10/21/2023 访问量:22
如何通过继承odoo 12中可用的模块在结帐部分添加按钮?
How to add button to position in checkout section by inheriting module available in odoo 12?
问:
我做到了,但没有显示按钮,下面是我的代码。
custom_buttom_payment.js:
odoo.define('pos_custom_button_payment.custom_button_payment', function (require) {
"use strict";
var screen = require('point_of_sale.screens');
screen.PaymentScreenWidget.include({
renderElement: function() {
var self = this;
this._super();
this.$('.js_clear_orderline').click(function(){
});
},
});
});
button_custom.xml:
<?xml version="1.0" encoding="utf-8"?>
<templates id="template" xml:space="preserve">
<t t-extend="PaymentScreenWidget">
<t t-jquery="div[class*='js_set_customer']" t-operation="after">
<div class='left_button js_clear_orderline'>
<div class="button-icon">
<img src="/pos_custom_button_payment/static/src/icons/icon.png" class="pos_logo"/>
</div>
<div class='button-name'>
HELLO
</div>
</div>
</t>
</t>
</templates>
视图:.xml:
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="pos_custom_button" inherit_id="point_of_sale.assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/pos_custom_button_payment/static/src/js/custom_button_payment.js"/>
</xpath>
</template>
</data>
</odoo>
希望大家能帮助我,我已经尝试了很多方法,但仍然不起作用。
答:
0赞
Kenly
10/21/2023
#1
您可能忘记在清单文件中的条目下添加模板文件qweb
例:
'qweb': ['static/src/xml/button_custom.xml'],
评论