This question has been flagged
1 Reply
2400 Views

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

Avatar
Discard
Author Best Answer

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;

}

});

Avatar
Discard