Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
3630 Zobrazení

How can we inherit method of class in js 
I have to inherit one of the method of FormController from web/../src/views/...js. then how can i inherit this method into custom module. method name - getActionMenuItems

Avatar
Zrušit
Nejlepší odpověď
/** @odoo-module **/
import { FormController } from "@web/views/form/form_controller";
import {patch} from "@web/core/utils/patch";

patch(FormController.prototype, "CustomFormController", {

​getActionMenuItems() {
​//your code
​​this._super.apply(this, arguments);
​//your code
​}

});



Avatar
Zrušit
Nejlepší odpověď

Hi,

Please refer to the code below. It will give you an idea on how to inherit OWL Js:


/** @odoo-module **/


import { FormController } from "@web/views/form/form_controller";


export class CustomFormController extends FormController {


getActionMenuItems() {

const superVals = super.getActionMenuItems();

// Your code

return superVals;


}


export const CustomFormView = {

...formView,

Controller: CustomFormController,

};


registry.category("views").add("custom_form", CustomFormView);


Hope it helps

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
5
led 23
14202
1
zář 17
4701
2
čvc 17
4494
0
kvě 24
2000
1
říj 23
1807