如何在POS(Odoo 10)中修改付款界面

时间:2018-07-13 06:42:48

标签: javascript xml odoo odoo-10 point-of-sale

我目前在Odoo上的POS中挣扎。我是使用Java修改Odoo前端的新手。

我已经看过不同的模块,但是我很困惑,已经搜索了它,但是在较旧的Odoo版本8和9中发现了相关的问题和解决方案。

我要做的就是在付款界面的“现金(USD)”按钮下面添加“护理”按钮,并添加一些功能。

payment interface

但是

它出现在小键盘面板上方的左窗格中。

使用此行代码。

pos_custom / static / src / js

pos_custom.js

odoo.define('pos_custom.pos_custom', function (require) {
"use strict";

var screens = require('point_of_sale.screens');

var careOfButton = screens.ActionButtonWidget.extend({
    template: 'careOfButton',

    button_click: function(){
        var self = this;
        this.gui.show_popup('selection',{
            'title': 'Welcome to JS world',

        });
    },

});

    screens.define_action_button({
        'name': 'careOf',
        'widget': careOfButton,
    });
});

pos_custom / static / src / xml

pos_custom.xml

<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">

    <t t-name="careOfButton">
        <div class='control-button'>
            <i class='fa fa-tag' /> Care of
        </div>
    </t>

</templates>

wrong output

请帮助我。任何建议/可能的解决方案。谢谢

1 个答案:

答案 0 :(得分:1)

您必须继承模板PaymentScreen-Paymentmethods并将按钮放在所有付款方式之后,您的模板应如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" inherit_id="point_of_sale.template">

<t t-extend="PaymentScreen-Paymentmethods">
    <t t-jquery="div[class='paymentmethods']" t-operation="after">
        <div class='control-button'>
            <i class='fa fa-tag' /> Care of
        </div>
    </t>
</t>

对于jquery选择器,请查看documentation

我希望这个答案对您有帮助。

相关问题