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
此問題已被標幟
2
回覆
5984
瀏覽次數
/** @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
}
});
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
| 相關帖文 | 回覆 | 瀏覽次數 | 活動 | |
|---|---|---|---|---|
|
|
5
1月 23
|
16448 | ||
|
|
1
9月 17
|
6540 | ||
|
|
2
7月 17
|
6371 | ||
|
|
0
5月 24
|
5301 | ||
|
|
1
10月 23
|
3664 |