mirror of https://github.com/OCA/web.git
Merge pull request #322 from OCA/revert-312-9.0-widget-many2many-multi-selection
Revert "[MIG]Migrated web widget many2many_tags multi selection in v9"pull/323/head
commit
e24a106efc
|
@ -29,7 +29,6 @@ Contributors
|
||||||
------------
|
------------
|
||||||
|
|
||||||
* Sylvain Calador <sylvain.calador@akretion.com>
|
* Sylvain Calador <sylvain.calador@akretion.com>
|
||||||
* Jamin Shah <jaiminshah2009@gmail.com>
|
|
||||||
|
|
||||||
Maintainer
|
Maintainer
|
||||||
----------
|
----------
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Tags multiple selection',
|
'name': 'Tags multiple selection',
|
||||||
'version': '9.0.1.1.0',
|
'version': '8.0.0.1.0',
|
||||||
'author': 'Akretion, Odoo Community Association (OCA), Jamin Shah',
|
'author': 'Akretion, Odoo Community Association (OCA)',
|
||||||
'depends': [
|
'depends': [
|
||||||
'web',
|
'web',
|
||||||
],
|
],
|
||||||
|
@ -31,6 +31,6 @@
|
||||||
'data': [
|
'data': [
|
||||||
'views/web_widget_many2many_tags_multi_selection.xml',
|
'views/web_widget_many2many_tags_multi_selection.xml',
|
||||||
],
|
],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
'auto_install': False,
|
'auto_install': False,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,31 @@
|
||||||
odoo.define('web_widget_many2many_tags_multi_selection.multiple_tags', function (require) {
|
openerp.web_widget_many2many_tags_multi_selection = function(instance, local) {
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var FormCommon = require('web.form_common');
|
var _t = instance.web._t;
|
||||||
var core = require('web.core');
|
|
||||||
var data = require('web.data');
|
|
||||||
var _t = core._t;
|
|
||||||
|
|
||||||
FormCommon.CompletionFieldMixin._search_create_popup = function(view, ids, context) {
|
instance.web.form.CompletionFieldMixin._search_create_popup = function(view, ids, context) {
|
||||||
var self = this;
|
var self = this;
|
||||||
new FormCommon.SelectCreateDialog(this, {
|
var pop = new instance.web.form.SelectCreatePopup(this);
|
||||||
res_model: self.field.relation,
|
var domain = self.build_domain();
|
||||||
domain: self.build_domain(),
|
|
||||||
context: new data.CompoundContext(self.build_context(), context || {}),
|
if (self.field.type == 'many2many') {
|
||||||
|
var selected_ids = self.get_search_blacklist();
|
||||||
|
if (selected_ids.length > 0) {
|
||||||
|
domain = new instance.web.CompoundDomain(domain, ["!", ["id", "in", selected_ids]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pop.select_element(
|
||||||
|
self.field.relation,
|
||||||
|
{
|
||||||
title: (view === 'search' ? _t("Search: ") : _t("Create: ")) + this.string,
|
title: (view === 'search' ? _t("Search: ") : _t("Create: ")) + this.string,
|
||||||
initial_ids: ids ? _.map(ids, function(x) {return x[0];}) : undefined,
|
initial_ids: ids ? _.map(ids, function(x) {return x[0];}) : undefined,
|
||||||
initial_view: view,
|
initial_view: view,
|
||||||
disable_multiple_selection: this.field.type != 'many2many',
|
disable_multiple_selection: this.field.type != 'many2many',
|
||||||
on_selected: function(element_ids) {
|
},
|
||||||
|
domain,
|
||||||
|
new instance.web.CompoundContext(self.build_context(), context || {})
|
||||||
|
);
|
||||||
|
pop.on("elements_selected", self, function(element_ids) {
|
||||||
for(var i=0, len=element_ids.length; i<len;i++) {
|
for(var i=0, len=element_ids.length; i<len;i++) {
|
||||||
self.add_id(element_ids[i]);
|
self.add_id(element_ids[i]);
|
||||||
if (self.field.type != 'many2many') {
|
if (self.field.type != 'many2many') {
|
||||||
|
@ -24,16 +33,6 @@ odoo.define('web_widget_many2many_tags_multi_selection.multiple_tags', function
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.focus();
|
self.focus();
|
||||||
}
|
|
||||||
}).open();
|
|
||||||
var domain = self.build_domain();
|
|
||||||
|
|
||||||
if (self.field.type == 'many2many') {
|
|
||||||
var selected_ids = self.get_search_blacklist();
|
|
||||||
if (selected_ids.length > 0) {
|
|
||||||
domain = new data.CompoundDomain(domain, ["!", ["id", "in", selected_ids]]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue