Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
3412 Представления

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;

}

});

Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
авг. 16
5077
0
мар. 15
4291
0
окт. 23
4797
2
окт. 19
9795
18
дек. 16
5693