Skip to Content
Menu
This question has been flagged
1 Reply
3310 Views

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.

Avatar
Discard
Best Answer

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!

Avatar
Discard

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

Related Posts Replies Views Activity
0
Nov 23
668
0
May 23
1697
0
Dec 22
1326
0
Oct 22
2065
0
Jun 22
735