콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
3316 화면

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
4977
0
3월 15
4218
0
10월 23
4730
2
10월 19
9652
18
12월 16
5612