|
@ -99,8 +99,7 @@ openerp.web_m2x_options = function (instance) { |
|
|
self.build_context())); |
|
|
self.build_context())); |
|
|
|
|
|
|
|
|
var create_rights; |
|
|
var create_rights; |
|
|
if (typeof this.options.create === "undefined" || |
|
|
|
|
|
typeof this.options.create_edit === "undefined") { |
|
|
|
|
|
|
|
|
if (!(self.options && (self.options.no_create || self.options.no_create_edit))) { |
|
|
create_rights = new instance.web.Model(this.field.relation).call( |
|
|
create_rights = new instance.web.Model(this.field.relation).call( |
|
|
"check_access_rights", ["create", false]); |
|
|
"check_access_rights", ["create", false]); |
|
|
} |
|
|
} |
|
@ -171,10 +170,15 @@ openerp.web_m2x_options = function (instance) { |
|
|
var raw_result = _(data.result).map(function (x) { |
|
|
var raw_result = _(data.result).map(function (x) { |
|
|
return x[1]; |
|
|
return x[1]; |
|
|
}); |
|
|
}); |
|
|
|
|
|
var no_quick_create = ( |
|
|
|
|
|
self.options && (self.options.no_create || |
|
|
|
|
|
self.options.no_quick_create) |
|
|
|
|
|
) |
|
|
|
|
|
var m2x_create_undef = _.isUndefined(self.view.ir_options['web_m2x_options.create']) |
|
|
|
|
|
var m2x_create = self.view.ir_options['web_m2x_options.create'] == "True" |
|
|
|
|
|
|
|
|
if ((_.isUndefined(self.options.create) && _.isUndefined(self.view.ir_options['web_m2x_options.create']) && can_create) || |
|
|
|
|
|
(_.isUndefined(self.options.create) && self.view.ir_options['web_m2x_options.create'] == "True") || |
|
|
|
|
|
self.options.create) { |
|
|
|
|
|
|
|
|
if (!no_quick_create && ((m2x_create_undef && can_create) || |
|
|
|
|
|
m2x_create)) { |
|
|
|
|
|
|
|
|
if (search_val.length > 0 && |
|
|
if (search_val.length > 0 && |
|
|
!_.include(raw_result, search_val)) { |
|
|
!_.include(raw_result, search_val)) { |
|
@ -192,10 +196,15 @@ openerp.web_m2x_options = function (instance) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// create...
|
|
|
// create...
|
|
|
|
|
|
var no_create_edit = ( |
|
|
|
|
|
self.options && (self.options.no_create || |
|
|
|
|
|
self.options.no_create_edit) |
|
|
|
|
|
) |
|
|
|
|
|
var m2x_create_edit_undef = _.isUndefined(self.view.ir_options['web_m2x_options.create_edit']) |
|
|
|
|
|
var m2x_create_edit = self.view.ir_options['web_m2x_options.create_edit'] == "True" |
|
|
|
|
|
|
|
|
if ((_.isUndefined(self.options.create_edit) && _.isUndefined(self.view.ir_options['web_m2x_options.create_edit']) && can_create) || |
|
|
|
|
|
(_.isUndefined(self.options.create) && self.view.ir_options['web_m2x_options.create_edit'] == "True") || |
|
|
|
|
|
self.options.create_edit) { |
|
|
|
|
|
|
|
|
if (!no_create_edit && ((m2x_create_edit_undef && can_create) || |
|
|
|
|
|
m2x_create_edit)) { |
|
|
|
|
|
|
|
|
values.push({ |
|
|
values.push({ |
|
|
label: _t("Create and Edit..."), |
|
|
label: _t("Create and Edit..."), |
|
@ -300,10 +309,15 @@ openerp.web_m2x_options = function (instance) { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
// quick create
|
|
|
// quick create
|
|
|
|
|
|
var no_quick_create = ( |
|
|
|
|
|
self.options && (self.options.no_create || |
|
|
|
|
|
self.options.no_quick_create) |
|
|
|
|
|
) |
|
|
|
|
|
var m2x_create_undef = _.isUndefined(self.view.ir_options['web_m2x_options.create']) |
|
|
|
|
|
var m2x_create = self.view.ir_options['web_m2x_options.create'] == "True" |
|
|
|
|
|
|
|
|
if ((_.isUndefined(self.options.create) && _.isUndefined(self.view.ir_options['web_m2x_options.create'])) || |
|
|
|
|
|
(_.isUndefined(self.options.create) && self.view.ir_options['web_m2x_options.create'] == 'True') || |
|
|
|
|
|
self.options.create) { |
|
|
|
|
|
|
|
|
if (!no_quick_create && ((m2x_create_undef && can_create) || |
|
|
|
|
|
m2x_create)) { |
|
|
|
|
|
|
|
|
var raw_result = _(data.result).map(function(x) {return x[1];}); |
|
|
var raw_result = _(data.result).map(function(x) {return x[1];}); |
|
|
if (search_val.length > 0 && !_.include(raw_result, search_val)) { |
|
|
if (search_val.length > 0 && !_.include(raw_result, search_val)) { |
|
@ -319,10 +333,15 @@ openerp.web_m2x_options = function (instance) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// create...
|
|
|
// create...
|
|
|
|
|
|
|
|
|
if ((_.isUndefined(self.options.create_edit === 'undefined') && _.isUndefined(self.view.ir_options['web_m2x_options.create_edit'])) || |
|
|
|
|
|
(_.isUndefined(self.options.create) && self.view.ir_options['web_m2x_options.create_edit'] == 'True') || |
|
|
|
|
|
self.options.create_edit) { |
|
|
|
|
|
|
|
|
var no_create_edit = ( |
|
|
|
|
|
self.options && (self.options.no_create || |
|
|
|
|
|
self.options.no_create_edit) |
|
|
|
|
|
) |
|
|
|
|
|
var m2x_create_edit_undef = _.isUndefined(self.view.ir_options['web_m2x_options.create_edit']) |
|
|
|
|
|
var m2x_create_edit = self.view.ir_options['web_m2x_options.create_edit'] == "True" |
|
|
|
|
|
|
|
|
|
|
|
if (!no_create_edit && ((m2x_create_edit_undef && can_create) || |
|
|
|
|
|
m2x_create_edit)) { |
|
|
|
|
|
|
|
|
values.push({ |
|
|
values.push({ |
|
|
label: _t("Create and Edit..."), |
|
|
label: _t("Create and Edit..."), |
|
|