|
@ -113,7 +113,7 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) { |
|
|
if (_.isUndefined(this.view)) |
|
|
if (_.isUndefined(this.view)) |
|
|
return this._super.apply(this, arguments); |
|
|
return this._super.apply(this, arguments); |
|
|
if (!_.isUndefined(this.view.ir_options['web_m2x_options.limit'])) { |
|
|
if (!_.isUndefined(this.view.ir_options['web_m2x_options.limit'])) { |
|
|
this.limit = parseInt(this.view.ir_options['web_m2x_options.limit']); |
|
|
|
|
|
|
|
|
this.limit = parseInt(this.view.ir_options['web_m2x_options.limit'], 10); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (typeof this.options.limit === 'number') { |
|
|
if (typeof this.options.limit === 'number') { |
|
@ -136,13 +136,14 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) { |
|
|
'ilike', this.limit + 1, |
|
|
'ilike', this.limit + 1, |
|
|
self.build_context())); |
|
|
self.build_context())); |
|
|
|
|
|
|
|
|
var create_rights; |
|
|
|
|
|
if (!(self.options && (self.is_option_set(self.options.create) || self.is_option_set(self.options.create_edit)))) { |
|
|
if (!(self.options && (self.is_option_set(self.options.create) || self.is_option_set(self.options.create_edit)))) { |
|
|
create_rights = new Model(this.field.relation).call( |
|
|
|
|
|
|
|
|
this.create_rights = this.create_rights || (function(){ |
|
|
|
|
|
return new Model(self.field.relation).call( |
|
|
"check_access_rights", ["create", false]); |
|
|
"check_access_rights", ["create", false]); |
|
|
|
|
|
})(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$.when(search_result, create_rights).then(function (data, can_create) { |
|
|
|
|
|
|
|
|
$.when(search_result, this.create_rights).then(function (data, can_create) { |
|
|
|
|
|
|
|
|
self.can_create = can_create; // for ``.show_error_displayer()``
|
|
|
self.can_create = can_create; // for ``.show_error_displayer()``
|
|
|
self.last_search = data; |
|
|
self.last_search = data; |
|
@ -216,7 +217,7 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) { |
|
|
m2x_create_undef = _.isUndefined(self.view.ir_options['web_m2x_options.create']), |
|
|
m2x_create_undef = _.isUndefined(self.view.ir_options['web_m2x_options.create']), |
|
|
m2x_create = self.is_option_set(self.view.ir_options['web_m2x_options.create']); |
|
|
m2x_create = self.is_option_set(self.view.ir_options['web_m2x_options.create']); |
|
|
var show_create = (!self.options && (m2x_create_undef || m2x_create)) || (self.options && (quick_create || (quick_create_undef && (m2x_create_undef || m2x_create)))); |
|
|
var show_create = (!self.options && (m2x_create_undef || m2x_create)) || (self.options && (quick_create || (quick_create_undef && (m2x_create_undef || m2x_create)))); |
|
|
if (show_create){ |
|
|
|
|
|
|
|
|
if (self.can_create && show_create){ |
|
|
if (search_val.length > 0 && |
|
|
if (search_val.length > 0 && |
|
|
!_.include(raw_result, search_val)) { |
|
|
!_.include(raw_result, search_val)) { |
|
|
|
|
|
|
|
@ -238,7 +239,7 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) { |
|
|
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)))); |
|
|
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)))); |
|
|
if (show_create_edit){ |
|
|
|
|
|
|
|
|
if (self.can_create && show_create_edit){ |
|
|
values.push({ |
|
|
values.push({ |
|
|
label: _t("Create and Edit..."), |
|
|
label: _t("Create and Edit..."), |
|
|
action: function () { |
|
|
action: function () { |
|
@ -318,7 +319,7 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) { |
|
|
// returned.
|
|
|
// returned.
|
|
|
|
|
|
|
|
|
if (!_.isUndefined(this.view.ir_options['web_m2x_options.limit'])) { |
|
|
if (!_.isUndefined(this.view.ir_options['web_m2x_options.limit'])) { |
|
|
this.limit = parseInt(this.view.ir_options['web_m2x_options.limit']); |
|
|
|
|
|
|
|
|
this.limit = parseInt(this.view.ir_options['web_m2x_options.limit'], 10); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (typeof this.options.limit === 'number') { |
|
|
if (typeof this.options.limit === 'number') { |
|
@ -408,7 +409,7 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) { |
|
|
var open = (self.options && self.is_option_set(self.options.open)); |
|
|
var open = (self.options && self.is_option_set(self.options.open)); |
|
|
if(open){ |
|
|
if(open){ |
|
|
self.mutex.exec(function(){ |
|
|
self.mutex.exec(function(){ |
|
|
var id = parseInt($(ev.currentTarget).data('id')); |
|
|
|
|
|
|
|
|
var id = parseInt($(ev.currentTarget).data('id'), 10); |
|
|
self.do_action({ |
|
|
self.do_action({ |
|
|
type: 'ir.actions.act_window', |
|
|
type: 'ir.actions.act_window', |
|
|
res_model: self.field.relation, |
|
|
res_model: self.field.relation, |
|
|