0

Hi I'm trying to override the renderElement function in PaymentScreenWidget in Odoo-12 POS

here's what I've tried so far

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();
            });

        },
});

it does work but it doubles all the button in the payment screen

Sample image doubled buttons

i have also tried replacing the this._super(); with PosBaseWidget.prototype.renderElement.call(this); but the problem is when the payment is process and I go back to selling part all the button in the payment part is left and covers the screen

user9523333
  • 187
  • 18

1 Answers1

0

user9523333

Try This code to access the 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
    });
});
Dipen Shah
  • 2,396
  • 2
  • 9
  • 21