【问题标题】:How to modify Payment Interface in POS (Odoo 10)如何在 POS 中修改支付接口(Odoo 10)
【发布时间】:2018-12-21 11:30:08
【问题描述】:

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

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

我要做的就是在支付界面的“Cash (USD)”按钮下方添加“Care of”按钮,并添加一些功能。

但是

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

使用这行代码。

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>

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

【问题讨论】:

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


    【解决方案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

    希望这个回答对你有帮助。

    【讨论】:

    • 如何在我的按钮上添加功能?
    • 在你回答之前我已经解决了我的问题,但是谢谢。我们的答案几乎一样
    • 在其他问题中发布其他问题。
    • 请问我有同样的问题,你可以发布你的答案
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-11
    • 2021-01-03
    • 1970-01-01
    • 2018-09-30
    相关资源
    最近更新 更多