【问题标题】:How to override renderElement function in screens.js in Odoo-12 Point of Sale如何在 Odoo-12 销售点覆盖 screen.js 中的 renderElement 函数
【发布时间】:2020-06-26 00:51:46
【问题描述】:

您好,我正在尝试覆盖 Odoo-12 POS 中 PaymentScreenWidget 中的 renderElement 函数

这是我目前尝试过的

POSScreen.PaymentScreenWidget.include({
    renderElement: function() {
            var self = this;
            this._super();

            var numpad = this.render_numpad();
            numpad.appendTo(this.$('.payment-numpad'));

            var methods = this.render_paymentmethods();
            methods.appendTo(this.$('.paymentmethods-container'));

            this.render_paymentlines();

            this.$('.back').click(function(){
                self.click_back();
            });

            this.$('.next').click(function(){
                if(self.check_payment_line() == "Cheque"){
                    self.pos.gui.show_popup('confirm',{
                        'title': _t('Payment Method Confirm'),
                        'body': _t('Cheque Payment method detected need the Cheque information first'),
                        confirm: function(){
                            self.enable_keyboard();
                            self.pos.gui.show_popup('cheque_input_popup_widget',{
                                title: _t('Check Input'),
                            });
                        },
                    });
                    
                }else if(self.check_payment_line() == "Cash"){
                    self.validate_order();
                }
                
            });
            this.$('.js_set_customer').click(function(){
                self.click_set_customer();
            });

            this.$('.js_tip').click(function(){
                self.click_tip();
            });
            this.$('.js_invoice').click(function(){
                self.click_invoice();
            });

            this.$('.js_cashdrawer').click(function(){
                self.pos.proxy.open_cashbox();
            });

        },
});

它确实有效,但它使支付屏幕上的所有按钮加倍

我也尝试将this._super(); 替换为PosBaseWidget.prototype.renderElement.call(this); 但问题是在付款过程中,我回到销售部分,付款部分中的所有按钮都留下并覆盖了屏幕

【问题讨论】:

    标签: javascript overriding odoo odoo-12 point-of-sale


    【解决方案1】:

    用户9523333

    试试这个code 访问PaymentScreenWidget

    odoo.define('module.ScreenCustomise', function(require) {
    "use strict";
    
        var screens = require('point_of_sale.screens');
        var PaymentScreenWidget = screens.PaymentScreenWidget;
    
        PaymentScreenWidget.include({
            renderElement: function() {
                var self = this;
                this._super();
                // Customise Your Code
        });
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多