Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
3916 Vizualizări

I tried  to super the function validateOrder(isForceValidate)...


var pos_model = require('point_of_sale.models');
const PaymentScreen = require('point_of_sale.PaymentScreen');

var models = pos_model.PosModel.prototype.models;

var rpc = require('web.rpc');


    class PosScreen extends PaymentScreen {



     constructor(isForceValidate) {
        super(isForceValidate);
        this.template = 'PaymentScreen';
  }

    async validateOrder(isForceValidate) {
//            var self = this;
            super.validateOrder(isForceValidate);
            console.log("validate==========================>")


        }


    }


but the console is not working when click validate button...how to super the function.

Imagine profil
Abandonează
Cel mai bun răspuns

Hi Sangeeth,

I might be late for this. But it might be helpful for someone else. You can override the validate function as follows:

odoo.define('module_name.POSValidateOverride', function(require) {
    'use strict';

    const PaymentScreen = require('point_of_sale.PaymentScreen');
    const Registries = require('point_of_sale.Registries');

    const POSValidateOverride = PaymentScreen =>
        class extends PaymentScreen {
            /**
             * @override
             */
            async validateOrder(isForceValidate) {
                console.log('POSValidateOverride::validateOrder(): successfully overridden');
                await super.validateOrder(isForceValidate);
                // Add your code
            }
        };

    Registries.Component.extend(PaymentScreen, POSValidateOverride);

    return PaymentScreen;
});

Hope that helps!

Imagine profil
Abandonează

This is absolute brilliant answer to the point for Odoo Version 14.

Related Posts Răspunsuri Vizualizări Activitate
0
nov. 23
1911
0
mai 23
2655
0
dec. 22
2469
0
oct. 22
3668
0
iun. 22
1730