コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
2991 ビュー

I would like to remove "Quick Create" & "Create and Edit" from all the models and all the fields. To achieve that I would like to inherit CompletionFieldMixin ( this ) and pop two values (Create  & Create and Edit ) from result returned by function get_search_result()
I tried like but

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

form_common.CompletionFieldMixin.get_search_result = function(search_val) {

// code here

};

but above method never gets called, however I am able to call the method like
var original_get_search_result = form_common.CompletionFieldMixin.get_search_result;
But no idea how to change the restult becuase that returns the function itself.

The idea how to inherit, I got from here but it doesn't work

アバター
破棄
著作者 最善の回答

The way I finally did it was replace init() and set this.can_create = false

odoo.define('eradicate_create_and_edit.form_common', function (require) {

"use strict";

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

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

form_common.CompletionFieldMixin.init = function() {

this.limit = 7;

this.orderer = new utils.DropMisordered();

this.can_create = false;

this.can_write = this.node.attrs.can_write || true;

}

});

アバター
破棄
関連投稿 返信 ビュー 活動
1
8月 16
4608
0
3月 15
3752
0
10月 23
4522
2
10月 19
9075
18
12月 16
5284