Reputation: 319
Friends,
Need to remove this option from pop up manyone
fields. (not in all fields
.some fields need to remove this feature).i used widget="selection"
.then my domain filter
not working.so please help me to find a solution.
Upvotes: 2
Views: 1235
Reputation: 5044
There is a module for openerp 6.1
to remove the create and edit option(in the openerp
apps site search for web remove) from the default selection of many2one
field. You can use this as an example and create you own module. or you can modify the base codes goto your server, then navigate to openerp/addons/web/static/src/js/view_form.js
and remove the quick create functionality defined from the line number 2860
.
This is the Same answer that I have given in openerp
help site.
Upvotes: 2
Reputation: 21
I have faced the same problem, but I solved it easily.
You need to change your web add-ons.
Please follow the step:
Go to: web/static/src/js
open the file: view_form.js
Go to line number 2958 or you can find label: _t
("Create and
Edit..."),
comment it
Enjoy, you can now see in your many2one fields don't have 'Create and Edit'
Note : This will affect every many2one field.
Upvotes: 2
Reputation: 7325
In v7 you can use the answer as suggested in http://help.openerp.com/question/16498/how-to-disable-create-and-edit-from-from-a-menu/
<form string="My form" create="false">
I had this problem in v6.1 though, so I created a new option so that I could apply it to only some fields (not all fields as suggested by @Bipin)
<form string="My form" options='{"no_create": true}'>
and changed web/static/src/js/view_form.js
// Hack: check for new "no_create" option:
if (self.get_definition_options().no_create === undefined || !self.get_definition_options().no_create) {
// the rest of the code stays asis:
// quick create
var raw_result = _(data.result).map(function(x) {return x[1];});
if (search_val.length > 0 &&
!_.include(raw_result, search_val) &&
(!self.value || search_val !== self.value[1])) {
values.push({label: _.str.sprintf(_t('<em> Create "<strong>%s</strong>"</em>'),
$('<span />').text(search_val).html()), action: function() {
self._quick_create(search_val);
}});
}
// create...
values.push({label: _t("<em> Create and Edit...</em>"), action: function() {
self._change_int_value(null);
self._search_create_popup("form", undefined, {"default_name": search_val});
}});
} // here endith the hack
I want to make this into a module, as editing the source code isn't very maintainable.
Upvotes: 0