mirror of https://github.com/OCA/web.git
[IMP] Taking into account core options:
- In Odoo 10.0 the flags 'no_create_edit' and 'no_create' can be used. Without this improvement, they are ignored, and all the views which use this flags are ignoredpull/888/merge
parent
ed6ffe9e2e
commit
08d83bb6b3
|
@ -125,6 +125,7 @@ Known issues
|
||||||
|
|
||||||
Double check that you have no inherited view that remove ``options`` you set on a field !
|
Double check that you have no inherited view that remove ``options`` you set on a field !
|
||||||
If nothing works, add a debugger in the first line of ``get_search_result method`` and enable debug mode in Odoo. When you write something in a many2one field, javascript debugger should pause. If not verify your installation.
|
If nothing works, add a debugger in the first line of ``get_search_result method`` and enable debug mode in Odoo. When you write something in a many2one field, javascript debugger should pause. If not verify your installation.
|
||||||
|
``create_edit`` and ``create`` are now supported by default in Odoo's core (``no_create_edit``, ``no_create``). So, these keywords should be removed when migrating to 11.0 (we keep them in version 10.0 to preserve the compatibility with the previous 10.0 versions of this module)
|
||||||
|
|
||||||
Roadmap
|
Roadmap
|
||||||
=======
|
=======
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
"name": 'web_m2x_options',
|
"name": 'web_m2x_options',
|
||||||
"version": "10.0.1.1.0",
|
"version": "10.0.1.1.1",
|
||||||
"depends": [
|
"depends": [
|
||||||
'base',
|
'base',
|
||||||
'web',
|
'web',
|
||||||
|
|
|
@ -239,12 +239,23 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Remove create_edit,create,no_create_edit and no_create options when migrating to 11.0 -> Odoo's core already support them by default
|
||||||
// create...
|
// create...
|
||||||
var create_edit = self.is_option_set(self.options.create) || self.is_option_set(self.options.create_edit),
|
var create_edit = self.is_option_set(self.options.create) || self.is_option_set(self.options.create_edit),
|
||||||
create_edit_undef = _.isUndefined(self.options.create) && _.isUndefined(self.options.create_edit),
|
create_edit_undef = _.isUndefined(self.options.create) && _.isUndefined(self.options.create_edit) && _.isUndefined(self.options.no_create) && _.isUndefined(self.options.no_create_edit),
|
||||||
m2x_create_edit_undef = _.isUndefined(self.view.ir_options['web_m2x_options.create_edit']),
|
m2x_create_edit_undef = _.isUndefined(self.view.ir_options['web_m2x_options.create_edit']),
|
||||||
m2x_create_edit = self.is_option_set(self.view.ir_options['web_m2x_options.create_edit']);
|
m2x_create_edit = self.is_option_set(self.view.ir_options['web_m2x_options.create_edit']),
|
||||||
var show_create_edit = (!self.options && (m2x_create_edit_undef || m2x_create_edit)) || (self.options && (create_edit || (create_edit_undef && (m2x_create_edit_undef || m2x_create_edit))));
|
no_create_edit = self.is_option_set(self.options.no_create) || self.is_option_set(self.options.no_create_edit),
|
||||||
|
no_create_edit_undef = _.isUndefined(self.options.no_create) && _.isUndefined(self.options.no_create_edit);
|
||||||
|
|
||||||
|
var show_create_edit = (!self.options && (m2x_create_edit_undef || m2x_create_edit));
|
||||||
|
if (!show_create_edit) {
|
||||||
|
if (no_create_edit_undef) {
|
||||||
|
show_create_edit = (self.options && (create_edit || (create_edit_undef && (m2x_create_edit_undef || m2x_create_edit))));
|
||||||
|
} else {
|
||||||
|
show_create_edit = (self.options && !no_create_edit);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (self.can_create && show_create_edit){
|
if (self.can_create && show_create_edit){
|
||||||
values.push({
|
values.push({
|
||||||
label: _t("Create and Edit..."),
|
label: _t("Create and Edit..."),
|
||||||
|
@ -389,12 +400,22 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Remove create_edit,create,no_create_edit and no_create options when migrating to 11.0 -> Odoo's core already support them by default
|
||||||
// create...
|
// create...
|
||||||
var create_edit = self.is_option_set(self.options.create) || self.is_option_set(self.options.create_edit),
|
var create_edit = self.is_option_set(self.options.create) || self.is_option_set(self.options.create_edit),
|
||||||
create_edit_undef = _.isUndefined(self.options.create) && _.isUndefined(self.options.create_edit),
|
create_edit_undef = _.isUndefined(self.options.create) && _.isUndefined(self.options.create_edit),
|
||||||
m2x_create_edit_undef = _.isUndefined(self.view.ir_options['web_m2x_options.create_edit']),
|
m2x_create_edit_undef = _.isUndefined(self.view.ir_options['web_m2x_options.create_edit']),
|
||||||
m2x_create_edit = self.is_option_set(self.view.ir_options['web_m2x_options.create_edit']);
|
m2x_create_edit = self.is_option_set(self.view.ir_options['web_m2x_options.create_edit']),
|
||||||
var show_create_edit = (!self.options && (m2x_create_edit_undef || m2x_create_edit)) || (self.options && (create_edit || (create_edit_undef && (m2x_create_edit_undef || m2x_create_edit))));
|
no_create_edit = self.is_option_set(self.options.no_create) || self.is_option_set(self.options.no_create_edit),
|
||||||
|
no_create_edit_undef = _.isUndefined(self.options.no_create) && _.isUndefined(self.options.no_create_edit);
|
||||||
|
var show_create_edit = (!self.options && (m2x_create_edit_undef || m2x_create_edit))
|
||||||
|
if (!show_create_edit) {
|
||||||
|
if (no_create_edit_undef) {
|
||||||
|
show_create_edit = (self.options && (create_edit || (create_edit_undef && (m2x_create_edit_undef || m2x_create_edit))));
|
||||||
|
} else {
|
||||||
|
show_create_edit = (self.options && !no_create_edit);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (show_create_edit){
|
if (show_create_edit){
|
||||||
|
|
||||||
values.push({
|
values.push({
|
||||||
|
|
Loading…
Reference in New Issue