From 8bd590f60492c224325956d5e75c5d65ab0e1f2d Mon Sep 17 00:00:00 2001 From: Nicolas JEUDY Date: Tue, 19 Nov 2013 00:12:30 +0100 Subject: [PATCH 01/67] - Rename web_m2o_enhanced to web_m2x_options - Add static/description/index.html fix: use include instead of extend in js function inheritance. fix: not overwriting the existing object references with the result of the include fix: update name according to new module name. fix: error when displaying many2many field without options defined. --- web_m2x_options/README.rst | 63 +++ web_m2x_options/__init__.py | 0 web_m2x_options/__openerp__.py | 46 +++ web_m2x_options/static/description/index.html | 391 ++++++++++++++++++ web_m2x_options/static/src/js/form.js | 224 ++++++++++ 5 files changed, 724 insertions(+) create mode 100644 web_m2x_options/README.rst create mode 100644 web_m2x_options/__init__.py create mode 100644 web_m2x_options/__openerp__.py create mode 100644 web_m2x_options/static/description/index.html create mode 100644 web_m2x_options/static/src/js/form.js diff --git a/web_m2x_options/README.rst b/web_m2x_options/README.rst new file mode 100644 index 000000000000..2b1fafdb57a2 --- /dev/null +++ b/web_m2x_options/README.rst @@ -0,0 +1,63 @@ +================================== +Add new options for many2one field +================================== + + +Description +----------- + +This modules modifies "many2one" form fields so as to add some new display +control options. + +** New: support many2manytags widget ! ** + +Options provided includes possibility to remove "Create..." and/or "Create and +Edit..." entries from many2one drop down. You can also change default number of +proposition appearing in the drop-down. Or prevent the dialog box poping in +case of validation error. + +If not specified, the module will avoid proposing any of the create options +if the current user have no permission rights to create the related object. + + +Requirements +------------ + +Was tested on openerp v7.0 + + +New option +---------- + +``create`` *boolean* (Default: depends if user have create rights) + + Whether to display the "Create..." entry in dropdown panel. + +``create_edit`` *boolean* (Default: depends if user have create rights) + + Whether to display "Create and Edit..." entry in dropdown panel + +``m2o_dialog`` *boolean* (Default: depends if user have create rights) + + Whether to display the many2one dialog in case of validation error. + +``limit`` *int* (Default: openerp default value is ``7``) + + Number of displayed record in drop-down panel + + +Example +------- + +Your XML form view definition could contain:: + + ... + + ... + +Note +---- + +Double check that you have no inherited view that remote ``options`` you set on a field ! +If nothing work, add a debugger in the first ligne of ``get_search_result method`` and enable debug mode in OpenERP. When you write something in a many2one field, javascript debugger should pause. If not verify your installation. + diff --git a/web_m2x_options/__init__.py b/web_m2x_options/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/web_m2x_options/__openerp__.py b/web_m2x_options/__openerp__.py new file mode 100644 index 000000000000..f428885e4a5e --- /dev/null +++ b/web_m2x_options/__openerp__.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- + +{ + "name": 'web_m2x_options', + "version": "0.1", + "description": +""" +===================================================== +Add new options for many2one and many2manytags field: +===================================================== + +- create: true/false -> disable "create" entry in dropdown panel +- create_edit: true/false -> disable "create and edit" entry in dropdown panel +- limit: 10 (int) -> change number of selected record return in dropdown panel +- m2o_dialog: true/false -> disable quick create M20Dialog triggered on error. + +Example: +-------- + + + +Note: +----- + +if one of those options are not set, many2one field use default many2one field options. + +Thanks to: +---------- + +- Nicolas JEUDY +- Valentin LAB + +""", + "depends": [ + 'base', + 'web', + ], + "js": [ + 'static/src/js/form.js', + ], + "author": "Tuxservices", + "installable" : True, + "active" : False, +} + + diff --git a/web_m2x_options/static/description/index.html b/web_m2x_options/static/description/index.html new file mode 100644 index 000000000000..30abedb7a5d9 --- /dev/null +++ b/web_m2x_options/static/description/index.html @@ -0,0 +1,391 @@ + + + + + + +Add new options for many2one field + + + +
+

Add new options for many2one field

+ +
+

Description

+

This modules modifies "many2one" form fields so as to add some new display +control options.

+

** New: support many2manytags widget ! **

+

Options provided includes possibility to remove "Create..." and/or "Create and +Edit..." entries from many2one drop down. You can also change default number of +proposition appearing in the drop-down. Or prevent the dialog box poping in +case of validation error.

+

If not specified, the module will avoid proposing any of the create options +if the current user have no permission rights to create the related object.

+
+
+

Requirements

+

Was tested on openerp v7.0

+
+
+

New option

+

create boolean (Default: depends if user have create rights)

+
+Whether to display the "Create..." entry in dropdown panel.
+

create_edit boolean (Default: depends if user have create rights)

+
+Whether to display "Create and Edit..." entry in dropdown panel
+

m2o_dialog boolean (Default: depends if user have create rights)

+
+Whether to display the many2one dialog in case of validation error.
+

limit int (Default: openerp default value is 7)

+
+Number of displayed record in drop-down panel
+
+
+

Example

+

Your XML form view definition could contain:

+
+...
+<field name="partner_id" options="{'limit': 10, 'create': false, 'create_edit': false}"/>
+...
+
+
+
+

Note

+

Double check that you have no inherited view that remote options you set on a field ! +If nothing work, add a debugger in the first ligne of get_search_result method and enable debug mode in OpenERP. When you write something in a many2one field, javascript debugger should pause. If not verify your installation.

+
+
+ + diff --git a/web_m2x_options/static/src/js/form.js b/web_m2x_options/static/src/js/form.js new file mode 100644 index 000000000000..00885a098b54 --- /dev/null +++ b/web_m2x_options/static/src/js/form.js @@ -0,0 +1,224 @@ +/*global openerp, _, $ */ + +openerp.web_m2x_options = function (instance) { + + "use strict"; + + var QWeb = instance.web.qweb, + _t = instance.web._t, + _lt = instance.web._lt; + + instance.web.form.FieldMany2One.include({ + + show_error_displayer: function () { + if ((typeof this.options.m2o_dialog === 'undefined' && this.can_create) || + this.options.m2o_dialog) { + new instance.web.form.M2ODialog(this).open(); + } + }, + + get_search_result: function (search_val) { + + var def = $.Deferred(); + var self = this; + // add options limit used to change number of selections record + // returned. + + if (typeof this.options.limit === 'number') { + this.limit = this.options.limit; + } + + var dataset = new instance.web.DataSet(this, this.field.relation, + self.build_context()); + var blacklist = this.get_search_blacklist(); + this.last_query = search_val; + + var search_result = this.orderer.add(dataset.name_search( + search_val, + new instance.web.CompoundDomain( + self.build_domain(), [["id", "not in", blacklist]]), + 'ilike', this.limit + 1, + self.build_context())); + + var create_rights; + if (typeof this.options.create === "undefined" || + typeof this.options.create_edit === "undefined") { + create_rights = new instance.web.Model(this.field.relation).call( + "check_access_rights", ["create", false]); + } + + $.when(search_result, create_rights).then(function (_data, _can_create) { + var data = _data[0]; + + var can_create = _can_create ? _can_create[0] : null; + + self.can_create = can_create; // for ``.show_error_displayer()`` + self.last_search = data; + // possible selections for the m2o + var values = _.map(data, function (x) { + x[1] = x[1].split("\n")[0]; + return { + label: _.str.escapeHTML(x[1]), + value: x[1], + name: x[1], + id: x[0], + }; + }); + + // search more... if more results that max + + if (values.length > self.limit) { + values = values.slice(0, self.limit); + values.push({ + label: _t("Search More..."), + action: function () { + dataset.name_search( + search_val, self.build_domain(), + 'ilike', false).done(function (data) { + self._search_create_popup("search", data); + }); + }, + classname: 'oe_m2o_dropdown_option' + }); + } + + // quick create + + var raw_result = _(data.result).map(function (x) { + return x[1]; + }); + + if ((typeof self.options.create === 'undefined' && can_create) || + self.options.create) { + + if (search_val.length > 0 && + !_.include(raw_result, search_val)) { + + values.push({ + label: _.str.sprintf( + _t('Create "%s"'), + $('').text(search_val).html()), + action: function () { + self._quick_create(search_val); + }, + classname: 'oe_m2o_dropdown_option' + }); + } + } + + // create... + + if ((typeof self.options.create_edit === 'undefined' && can_create) || + self.options.create_edit) { + + values.push({ + label: _t("Create and Edit..."), + action: function () { + self._search_create_popup( + "form", undefined, + self._create_context(search_val)); + }, + classname: 'oe_m2o_dropdown_option' + }); + } + + def.resolve(values); + }); + + return def; + } + }); + + instance.web.form.FieldMany2ManyTags.include({ + + show_error_displayer: function () { + if ((typeof this.options.m2o_dialog === 'undefined' && this.can_create) || + this.options.m2o_dialog) { + new instance.web.form.M2ODialog(this).open(); + } + }, + + /** + * Call this method to search using a string. + */ + + get_search_result: function(search_val) { + var self = this; + + // add options limit used to change number of selections record + // returned. + + if (typeof this.options.limit === 'number') { + this.limit = this.options.limit; + } + + var dataset = new instance.web.DataSet(this, this.field.relation, self.build_context()); + var blacklist = this.get_search_blacklist(); + this.last_query = search_val; + + return this.orderer.add(dataset.name_search( + search_val, new instance.web.CompoundDomain(self.build_domain(), [["id", "not in", blacklist]]), + 'ilike', this.limit + 1, self.build_context())).then(function(data) { + self.last_search = data; + // possible selections for the m2o + var values = _.map(data, function(x) { + x[1] = x[1].split("\n")[0]; + return { + label: _.str.escapeHTML(x[1]), + value: x[1], + name: x[1], + id: x[0], + }; + }); + + // search more... if more results that max + if (values.length > self.limit) { + values = values.slice(0, self.limit); + values.push({ + label: _t("Search More..."), + action: function() { + dataset.name_search(search_val, self.build_domain(), 'ilike', false).done(function(data) { + self._search_create_popup("search", data); + }); + }, + classname: 'oe_m2o_dropdown_option' + }); + } + // quick create + + if ((typeof self.options.create === 'undefined') || + self.options.create) { + + var raw_result = _(data.result).map(function(x) {return x[1];}); + if (search_val.length > 0 && !_.include(raw_result, search_val)) { + values.push({ + label: _.str.sprintf(_t('Create "%s"'), + $('').text(search_val).html()), + action: function() { + self._quick_create(search_val); + }, + classname: 'oe_m2o_dropdown_option' + }); + } + } + + // create... + + if ((typeof self.options.create_edit === 'undefined') || + self.options.create_edit) { + + values.push({ + label: _t("Create and Edit..."), + action: function() { + self._search_create_popup("form", undefined, self._create_context(search_val)); + }, + classname: 'oe_m2o_dropdown_option' + }); + } + + return values; + }) + }, + }); +}; + From 7621a8bd21d0fedd911809dac397a139cc368430 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Mon, 7 Jul 2014 13:11:28 +0200 Subject: [PATCH 02/67] move all addons to __unported__, set all addons as not installable --- web_m2x_options/README.rst | 63 --- web_m2x_options/__init__.py | 0 web_m2x_options/__openerp__.py | 46 --- web_m2x_options/static/description/index.html | 391 ------------------ web_m2x_options/static/src/js/form.js | 224 ---------- 5 files changed, 724 deletions(-) delete mode 100644 web_m2x_options/README.rst delete mode 100644 web_m2x_options/__init__.py delete mode 100644 web_m2x_options/__openerp__.py delete mode 100644 web_m2x_options/static/description/index.html delete mode 100644 web_m2x_options/static/src/js/form.js diff --git a/web_m2x_options/README.rst b/web_m2x_options/README.rst deleted file mode 100644 index 2b1fafdb57a2..000000000000 --- a/web_m2x_options/README.rst +++ /dev/null @@ -1,63 +0,0 @@ -================================== -Add new options for many2one field -================================== - - -Description ------------ - -This modules modifies "many2one" form fields so as to add some new display -control options. - -** New: support many2manytags widget ! ** - -Options provided includes possibility to remove "Create..." and/or "Create and -Edit..." entries from many2one drop down. You can also change default number of -proposition appearing in the drop-down. Or prevent the dialog box poping in -case of validation error. - -If not specified, the module will avoid proposing any of the create options -if the current user have no permission rights to create the related object. - - -Requirements ------------- - -Was tested on openerp v7.0 - - -New option ----------- - -``create`` *boolean* (Default: depends if user have create rights) - - Whether to display the "Create..." entry in dropdown panel. - -``create_edit`` *boolean* (Default: depends if user have create rights) - - Whether to display "Create and Edit..." entry in dropdown panel - -``m2o_dialog`` *boolean* (Default: depends if user have create rights) - - Whether to display the many2one dialog in case of validation error. - -``limit`` *int* (Default: openerp default value is ``7``) - - Number of displayed record in drop-down panel - - -Example -------- - -Your XML form view definition could contain:: - - ... - - ... - -Note ----- - -Double check that you have no inherited view that remote ``options`` you set on a field ! -If nothing work, add a debugger in the first ligne of ``get_search_result method`` and enable debug mode in OpenERP. When you write something in a many2one field, javascript debugger should pause. If not verify your installation. - diff --git a/web_m2x_options/__init__.py b/web_m2x_options/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/web_m2x_options/__openerp__.py b/web_m2x_options/__openerp__.py deleted file mode 100644 index f428885e4a5e..000000000000 --- a/web_m2x_options/__openerp__.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- - -{ - "name": 'web_m2x_options', - "version": "0.1", - "description": -""" -===================================================== -Add new options for many2one and many2manytags field: -===================================================== - -- create: true/false -> disable "create" entry in dropdown panel -- create_edit: true/false -> disable "create and edit" entry in dropdown panel -- limit: 10 (int) -> change number of selected record return in dropdown panel -- m2o_dialog: true/false -> disable quick create M20Dialog triggered on error. - -Example: --------- - - - -Note: ------ - -if one of those options are not set, many2one field use default many2one field options. - -Thanks to: ----------- - -- Nicolas JEUDY -- Valentin LAB - -""", - "depends": [ - 'base', - 'web', - ], - "js": [ - 'static/src/js/form.js', - ], - "author": "Tuxservices", - "installable" : True, - "active" : False, -} - - diff --git a/web_m2x_options/static/description/index.html b/web_m2x_options/static/description/index.html deleted file mode 100644 index 30abedb7a5d9..000000000000 --- a/web_m2x_options/static/description/index.html +++ /dev/null @@ -1,391 +0,0 @@ - - - - - - -Add new options for many2one field - - - -
-

Add new options for many2one field

- -
-

Description

-

This modules modifies "many2one" form fields so as to add some new display -control options.

-

** New: support many2manytags widget ! **

-

Options provided includes possibility to remove "Create..." and/or "Create and -Edit..." entries from many2one drop down. You can also change default number of -proposition appearing in the drop-down. Or prevent the dialog box poping in -case of validation error.

-

If not specified, the module will avoid proposing any of the create options -if the current user have no permission rights to create the related object.

-
-
-

Requirements

-

Was tested on openerp v7.0

-
-
-

New option

-

create boolean (Default: depends if user have create rights)

-
-Whether to display the "Create..." entry in dropdown panel.
-

create_edit boolean (Default: depends if user have create rights)

-
-Whether to display "Create and Edit..." entry in dropdown panel
-

m2o_dialog boolean (Default: depends if user have create rights)

-
-Whether to display the many2one dialog in case of validation error.
-

limit int (Default: openerp default value is 7)

-
-Number of displayed record in drop-down panel
-
-
-

Example

-

Your XML form view definition could contain:

-
-...
-<field name="partner_id" options="{'limit': 10, 'create': false, 'create_edit': false}"/>
-...
-
-
-
-

Note

-

Double check that you have no inherited view that remote options you set on a field ! -If nothing work, add a debugger in the first ligne of get_search_result method and enable debug mode in OpenERP. When you write something in a many2one field, javascript debugger should pause. If not verify your installation.

-
-
- - diff --git a/web_m2x_options/static/src/js/form.js b/web_m2x_options/static/src/js/form.js deleted file mode 100644 index 00885a098b54..000000000000 --- a/web_m2x_options/static/src/js/form.js +++ /dev/null @@ -1,224 +0,0 @@ -/*global openerp, _, $ */ - -openerp.web_m2x_options = function (instance) { - - "use strict"; - - var QWeb = instance.web.qweb, - _t = instance.web._t, - _lt = instance.web._lt; - - instance.web.form.FieldMany2One.include({ - - show_error_displayer: function () { - if ((typeof this.options.m2o_dialog === 'undefined' && this.can_create) || - this.options.m2o_dialog) { - new instance.web.form.M2ODialog(this).open(); - } - }, - - get_search_result: function (search_val) { - - var def = $.Deferred(); - var self = this; - // add options limit used to change number of selections record - // returned. - - if (typeof this.options.limit === 'number') { - this.limit = this.options.limit; - } - - var dataset = new instance.web.DataSet(this, this.field.relation, - self.build_context()); - var blacklist = this.get_search_blacklist(); - this.last_query = search_val; - - var search_result = this.orderer.add(dataset.name_search( - search_val, - new instance.web.CompoundDomain( - self.build_domain(), [["id", "not in", blacklist]]), - 'ilike', this.limit + 1, - self.build_context())); - - var create_rights; - if (typeof this.options.create === "undefined" || - typeof this.options.create_edit === "undefined") { - create_rights = new instance.web.Model(this.field.relation).call( - "check_access_rights", ["create", false]); - } - - $.when(search_result, create_rights).then(function (_data, _can_create) { - var data = _data[0]; - - var can_create = _can_create ? _can_create[0] : null; - - self.can_create = can_create; // for ``.show_error_displayer()`` - self.last_search = data; - // possible selections for the m2o - var values = _.map(data, function (x) { - x[1] = x[1].split("\n")[0]; - return { - label: _.str.escapeHTML(x[1]), - value: x[1], - name: x[1], - id: x[0], - }; - }); - - // search more... if more results that max - - if (values.length > self.limit) { - values = values.slice(0, self.limit); - values.push({ - label: _t("Search More..."), - action: function () { - dataset.name_search( - search_val, self.build_domain(), - 'ilike', false).done(function (data) { - self._search_create_popup("search", data); - }); - }, - classname: 'oe_m2o_dropdown_option' - }); - } - - // quick create - - var raw_result = _(data.result).map(function (x) { - return x[1]; - }); - - if ((typeof self.options.create === 'undefined' && can_create) || - self.options.create) { - - if (search_val.length > 0 && - !_.include(raw_result, search_val)) { - - values.push({ - label: _.str.sprintf( - _t('Create "%s"'), - $('').text(search_val).html()), - action: function () { - self._quick_create(search_val); - }, - classname: 'oe_m2o_dropdown_option' - }); - } - } - - // create... - - if ((typeof self.options.create_edit === 'undefined' && can_create) || - self.options.create_edit) { - - values.push({ - label: _t("Create and Edit..."), - action: function () { - self._search_create_popup( - "form", undefined, - self._create_context(search_val)); - }, - classname: 'oe_m2o_dropdown_option' - }); - } - - def.resolve(values); - }); - - return def; - } - }); - - instance.web.form.FieldMany2ManyTags.include({ - - show_error_displayer: function () { - if ((typeof this.options.m2o_dialog === 'undefined' && this.can_create) || - this.options.m2o_dialog) { - new instance.web.form.M2ODialog(this).open(); - } - }, - - /** - * Call this method to search using a string. - */ - - get_search_result: function(search_val) { - var self = this; - - // add options limit used to change number of selections record - // returned. - - if (typeof this.options.limit === 'number') { - this.limit = this.options.limit; - } - - var dataset = new instance.web.DataSet(this, this.field.relation, self.build_context()); - var blacklist = this.get_search_blacklist(); - this.last_query = search_val; - - return this.orderer.add(dataset.name_search( - search_val, new instance.web.CompoundDomain(self.build_domain(), [["id", "not in", blacklist]]), - 'ilike', this.limit + 1, self.build_context())).then(function(data) { - self.last_search = data; - // possible selections for the m2o - var values = _.map(data, function(x) { - x[1] = x[1].split("\n")[0]; - return { - label: _.str.escapeHTML(x[1]), - value: x[1], - name: x[1], - id: x[0], - }; - }); - - // search more... if more results that max - if (values.length > self.limit) { - values = values.slice(0, self.limit); - values.push({ - label: _t("Search More..."), - action: function() { - dataset.name_search(search_val, self.build_domain(), 'ilike', false).done(function(data) { - self._search_create_popup("search", data); - }); - }, - classname: 'oe_m2o_dropdown_option' - }); - } - // quick create - - if ((typeof self.options.create === 'undefined') || - self.options.create) { - - var raw_result = _(data.result).map(function(x) {return x[1];}); - if (search_val.length > 0 && !_.include(raw_result, search_val)) { - values.push({ - label: _.str.sprintf(_t('Create "%s"'), - $('').text(search_val).html()), - action: function() { - self._quick_create(search_val); - }, - classname: 'oe_m2o_dropdown_option' - }); - } - } - - // create... - - if ((typeof self.options.create_edit === 'undefined') || - self.options.create_edit) { - - values.push({ - label: _t("Create and Edit..."), - action: function() { - self._search_create_popup("form", undefined, self._create_context(search_val)); - }, - classname: 'oe_m2o_dropdown_option' - }); - } - - return values; - }) - }, - }); -}; - From e1fd690f56109b0528f020e1036e4eab38344f2b Mon Sep 17 00:00:00 2001 From: Nicolas JEUDY Date: Mon, 5 Jan 2015 12:24:37 +0100 Subject: [PATCH 03/67] fix: obscur wrong path on last commit. recreate portage from scratch. --- web_m2x_options/README.rst | 115 +++++ web_m2x_options/__init__.py | 0 web_m2x_options/__openerp__.py | 14 + web_m2x_options/static/description/icon.png | Bin 0 -> 9455 bytes web_m2x_options/static/description/index.html | 412 ++++++++++++++++++ web_m2x_options/static/src/js/form.js | 341 +++++++++++++++ web_m2x_options/views/view.xml | 12 + 7 files changed, 894 insertions(+) create mode 100644 web_m2x_options/README.rst create mode 100644 web_m2x_options/__init__.py create mode 100644 web_m2x_options/__openerp__.py create mode 100644 web_m2x_options/static/description/icon.png create mode 100644 web_m2x_options/static/description/index.html create mode 100644 web_m2x_options/static/src/js/form.js create mode 100644 web_m2x_options/views/view.xml diff --git a/web_m2x_options/README.rst b/web_m2x_options/README.rst new file mode 100644 index 000000000000..be6e76039157 --- /dev/null +++ b/web_m2x_options/README.rst @@ -0,0 +1,115 @@ +================================== +Add new options for many2one field +================================== + + +Description +----------- + +This modules modifies "many2one" and "many2manytags" form widgets so as to add some new display +control options. + +**New: support many2manytags widget !** + +**New: support global option management with ir.config_parameter !** + +Options provided includes possibility to remove "Create..." and/or "Create and +Edit..." entries from many2one drop down. You can also change default number of +proposition appearing in the drop-down. Or prevent the dialog box poping in +case of validation error. + +If not specified, the module will avoid proposing any of the create options +if the current user have no permission rights to create the related object. + + +Requirements +------------ + +Was tested on openerp 8.0, trunk, saas-5 branch. New way to import js file. (thanks to tfossoul) + + +New options +----------- + +``create`` *boolean* (Default: depends if user have create rights) + + Whether to display the "Create..." entry in dropdown panel. + +``create_edit`` *boolean* (Default: depends if user have create rights) + + Whether to display "Create and Edit..." entry in dropdown panel + +``m2o_dialog`` *boolean* (Default: depends if user have create rights) + + Whether to display the many2one dialog in case of validation error. + +``limit`` *int* (Default: openerp default value is ``7``) + + Number of displayed record in drop-down panel + +``search_more`` *boolean* + + Used to force disable/enable search more button. + +``field_color`` *string* + + A string to define the field used to define color. + This option has to be used with colors. + +``colors`` *dictionary* + + A dictionary to link field value with a HTML color. + This option has to be used with field_color. + + + +ir.config_parameter options +--------------------------- + +Now you can disable "Create..." and "Create and Edit..." entry for all widgets in the odoo instance. +If you disable one option, you can enable it for particular field by setting "create: True" option directly on the field definition. + +``web_m2x_options.create`` *boolean* (Default: depends if user have create rights) + + Whether to display the "Create..." entry in dropdown panel for all fields in the odoo instance. + +``web_m2x_options.create_edit`` *boolean* (Default: depends if user have create rights) + + Whether to display "Create and Edit..." entry in dropdown panel for all fields in the odoo instance. + +``web_m2x_options.m2o_dialog`` *boolean* (Default: depends if user have create rights) + + Whether to display the many2one dialog in case of validation error for all fields in the odoo instance. + +``web_m2x_options.limit`` *int* (Default: openerp default value is ``7``) + + Number of displayed record in drop-down panel for all fields in the odoo instance + +``web_m2x_options.search_more`` *boolean* (Default: default value is ``False``) + + Whether the field should always show "Search more..." entry or not. + +To add these parameters go to Configuration -> Technical -> Parameters -> System Parameters and add new parameters like: + +- web_m2x_options.create: False +- web_m2x_options.create_edit: False +- web_m2x_options.m2o_dialog: False +- web_m2x_options.limit: 10 +- web_m2x_options.search_more: True + + +Example +------- + +Your XML form view definition could contain:: + + ... + + ... + +Note +---- + +Double check that you have no inherited view that remote ``options`` you set on a field ! +If nothing work, add a debugger in the first ligne of ``get_search_result method`` and enable debug mode in OpenERP. When you write something in a many2one field, javascript debugger should pause. If not verify your installation. + diff --git a/web_m2x_options/__init__.py b/web_m2x_options/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/web_m2x_options/__openerp__.py b/web_m2x_options/__openerp__.py new file mode 100644 index 000000000000..37b7dbf4e770 --- /dev/null +++ b/web_m2x_options/__openerp__.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- + +{ + "name": 'web_m2x_options', + "version": "8.0.0.2", + "depends": [ + 'base', + 'web', + ], + 'data': ['views/view.xml'], + "author": "0k.io,Odoo Community Association (OCA)", + "installable": True, + "active": False, +} diff --git a/web_m2x_options/static/description/icon.png b/web_m2x_options/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 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 z 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 Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/web_m2x_options/static/description/index.html b/web_m2x_options/static/description/index.html new file mode 100644 index 000000000000..bf406ab1885f --- /dev/null +++ b/web_m2x_options/static/description/index.html @@ -0,0 +1,412 @@ + + + + + + +Add new options for many2one field + + + +
+

Add new options for many2one field

+ +
+

Description

+

This modules modifies "many2one" and "many2manytags" form widgets so as to add some new display +control options.

+

New: support many2manytags widget !

+

New: support global option management with ir.config_parameter !

+

Options provided includes possibility to remove "Create..." and/or "Create and +Edit..." entries from many2one drop down. You can also change default number of +proposition appearing in the drop-down. Or prevent the dialog box poping in +case of validation error.

+

If not specified, the module will avoid proposing any of the create options +if the current user have no permission rights to create the related object.

+
+
+

Requirements

+

Was tested on openerp 8.0, trunk, saas-5 branch. New way to import js file. (thanks to tfossoul)

+
+
+

New options

+

create boolean (Default: depends if user have create rights)

+
+Whether to display the "Create..." entry in dropdown panel.
+

create_edit boolean (Default: depends if user have create rights)

+
+Whether to display "Create and Edit..." entry in dropdown panel
+

m2o_dialog boolean (Default: depends if user have create rights)

+
+Whether to display the many2one dialog in case of validation error.
+

limit int (Default: openerp default value is 7)

+
+Number of displayed record in drop-down panel
+
+
+

ir.config_parameter options

+

Now you can disable "Create..." and "Create and Edit..." entry for all widgets in the odoo instance. +If you disable one option, you can enable it for particular field by setting "create: True" option directly on the field definition.

+

web_m2x_options.create boolean (Default: depends if user have create rights)

+
+Whether to display the "Create..." entry in dropdown panel for all fields in the odoo instance.
+

web_m2x_options.create_edit boolean (Default: depends if user have create rights)

+
+Whether to display "Create and Edit..." entry in dropdown panel for all fields in the odoo instance.
+

web_m2x_options.limit int (Default: openerp default value is 7)

+
+Number of displayed record in drop-down panel for all fields in the odoo instance
+

To add these parameters go to Configuration -> Technical -> Parameters -> System Parameters and add new parameters like:

+
    +
  • web_m2x_options.create: False
  • +
  • web_m2x_options.create_edit: False
  • +
  • web_m2x_options.limit: 10
  • +
+
+
+

Example

+

Your XML form view definition could contain:

+
+...
+<field name="partner_id" options="{'limit': 10, 'create': false, 'create_edit': false}"/>
+...
+
+
+
+

Note

+

Double check that you have no inherited view that remote options you set on a field ! +If nothing work, add a debugger in the first ligne of get_search_result method and enable debug mode in OpenERP. When you write something in a many2one field, javascript debugger should pause. If not verify your installation.

+
+
+ + diff --git a/web_m2x_options/static/src/js/form.js b/web_m2x_options/static/src/js/form.js new file mode 100644 index 000000000000..bc4d3bebd335 --- /dev/null +++ b/web_m2x_options/static/src/js/form.js @@ -0,0 +1,341 @@ +/*global openerp, _, $ */ + +openerp.web_m2x_options = function (instance) { + + "use strict"; + + var QWeb = instance.web.qweb, + _t = instance.web._t, + _lt = instance.web._lt; + + var OPTIONS = ['web_m2x_options.create', + 'web_m2x_options.create_edit', + 'web_m2x_options.limit', + 'web_m2x_options.search_more', + 'web_m2x_options.m2o_dialog',]; + + instance.web.form.FieldMany2One = instance.web.form.FieldMany2One.extend({ + + start: function() { + this._super.apply(this, arguments); + return this.get_options(); + }, + + get_options: function() { + var self = this; + if (!_.isUndefined(this.view) && _.isUndefined(this.view.ir_options_loaded)) { + this.view.ir_options_loaded = $.Deferred(); + this.view.ir_options = {}; + (new instance.web.Model("ir.config_parameter")) + .query(["key", "value"]).filter([['key', 'in', OPTIONS]]) + .all().then(function(records) { + _(records).each(function(record) { + self.view.ir_options[record.key] = record.value; + }); + self.view.ir_options_loaded.resolve(); + }); + return this.view.ir_options_loaded; + } + return $.when(); + }, + + is_option_set: function(option) { + if (_.isUndefined(option)) { + return false + } + var is_string = typeof option === 'string' + var is_bool = typeof option === 'boolean' + if (is_string) { + return option === 'true' || option === 'True' + } else if (is_bool) { + return option + } + return false + }, + + show_error_displayer: function () { + if(this.is_option_set(this.options.m2o_dialog) || + _.isUndefined(this.options.m2o_dialog) && this.is_option_set(this.view.ir_options['web_m2x_options.m2o_dialog']) || + this.can_create && _.isUndefined(this.options.m2o_dialog) && _.isUndefined(this.view.ir_options['web_m2x_options.m2o_dialog'])) { + new instance.web.form.M2ODialog(this).open(); + } + }, + + get_search_result: function (search_val) { + var Objects = new instance.web.Model(this.field.relation); + var def = $.Deferred(); + var self = this; + // add options limit used to change number of selections record + // returned. + if (_.isUndefined(this.view)) + return this._super.apply(this, arguments); + if (!_.isUndefined(this.view.ir_options['web_m2x_options.limit'])) { + this.limit = parseInt(this.view.ir_options['web_m2x_options.limit']); + } + + if (typeof this.options.limit === 'number') { + this.limit = this.options.limit; + } + + // add options search_more to force enable or disable search_more button + if (this.is_option_set(this.options.search_more) || _.isUndefined(this.options.search_more) && this.is_option_set(self.view.ir_options['web_m2x_options.search_more'])) { + this.search_more = true + } + + // add options field_color and colors to color item(s) depending on field_color value + this.field_color = this.options.field_color + this.colors = this.options.colors + + var dataset = new instance.web.DataSet(this, this.field.relation, + self.build_context()); + var blacklist = this.get_search_blacklist(); + this.last_query = search_val; + + var search_result = this.orderer.add(dataset.name_search( + search_val, + new instance.web.CompoundDomain( + self.build_domain(), [["id", "not in", blacklist]]), + 'ilike', this.limit + 1, + self.build_context())); + + var create_rights; + if (typeof this.options.create === "undefined" || + typeof this.options.create_edit === "undefined") { + create_rights = new instance.web.Model(this.field.relation).call( + "check_access_rights", ["create", false]); + } + + $.when(search_result, create_rights).then(function (data, can_create) { + + self.can_create = can_create; // for ``.show_error_displayer()`` + self.last_search = data; + // possible selections for the m2o + var values = _.map(data, function (x) { + x[1] = x[1].split("\n")[0]; + return { + label: _.str.escapeHTML(x[1]), + value: x[1], + name: x[1], + id: x[0], + }; + }); + + // Search result value colors + + if (self.colors && self.field_color) { + var value_ids = []; + for (var index in values) { + value_ids.push(values[index].id); + } + + // RPC request to get field_color from Objects + Objects.query([self.field_color]) + .filter([['id', 'in', value_ids]]) + .all().done(function (objects) { + for (var index in objects) { + for (var index_value in values) { + if (values[index_value].id == objects[index].id) { + // Find value in values by comparing ids + var value = values[index_value]; + + // Find color with field value as key + var color = self.colors[objects[index][self.field_color]] || 'black'; + value.label = ''+value.label+''; + break; + } + } + } + def.resolve(values); + }); + } + + // search more... if more results that max + + if (values.length > self.limit || self.search_more) { + values = values.slice(0, self.limit); + values.push({ + label: _t("Search More..."), + action: function () { + dataset.name_search( + search_val, self.build_domain(), + 'ilike', false).done(function (data) { + self._search_create_popup("search", data); + }); + }, + classname: 'oe_m2o_dropdown_option' + }); + } + + // quick create + + var raw_result = _(data.result).map(function (x) { + return x[1]; + }); + + 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 (search_val.length > 0 && + !_.include(raw_result, search_val)) { + + values.push({ + label: _.str.sprintf( + _t('Create "%s"'), + $('').text(search_val).html()), + action: function () { + self._quick_create(search_val); + }, + classname: 'oe_m2o_dropdown_option' + }); + } + } + + // create... + + 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) { + + values.push({ + label: _t("Create and Edit..."), + action: function () { + self._search_create_popup( + "form", undefined, + self._create_context(search_val)); + }, + classname: 'oe_m2o_dropdown_option' + }); + } + + // Check if colors specified to wait for RPC + if (!(self.field_color && self.colors)){ + def.resolve(values); + } + }); + + return def; + } + }); + + instance.web.form.FieldMany2ManyTags.include({ + + show_error_displayer: function () { + if ((typeof this.options.m2o_dialog === 'undefined' && this.can_create) || + this.options.m2o_dialog) { + new instance.web.form.M2ODialog(this).open(); + } + }, + + start: function() { + this._super.apply(this, arguments); + return this.get_options(); + }, + + get_options: function() { + var self = this; + if (_.isUndefined(this.view.ir_options_loaded)) { + this.view.ir_options_loaded = $.Deferred(); + this.view.ir_options = {}; + (new instance.web.Model("ir.config_parameter")) + .query(["key", "value"]).filter([['key', 'in', OPTIONS]]) + .all().then(function(records) { + _(records).each(function(record) { + self.view.ir_options[record.key] = record.value; + }); + self.view.ir_options_loaded.resolve(); + }); + } + return this.view.ir_options_loaded; + }, + + /** + * Call this method to search using a string. + */ + + get_search_result: function(search_val) { + var self = this; + + // add options limit used to change number of selections record + // returned. + + if (!_.isUndefined(this.view.ir_options['web_m2x_options.limit'])) { + this.limit = parseInt(this.view.ir_options['web_m2x_options.limit']); + } + + if (typeof this.options.limit === 'number') { + this.limit = this.options.limit; + } + + var dataset = new instance.web.DataSet(this, this.field.relation, self.build_context()); + var blacklist = this.get_search_blacklist(); + this.last_query = search_val; + + return this.orderer.add(dataset.name_search( + search_val, new instance.web.CompoundDomain(self.build_domain(), [["id", "not in", blacklist]]), + 'ilike', this.limit + 1, self.build_context())).then(function(data) { + self.last_search = data; + // possible selections for the m2o + var values = _.map(data, function(x) { + x[1] = x[1].split("\n")[0]; + return { + label: _.str.escapeHTML(x[1]), + value: x[1], + name: x[1], + id: x[0], + }; + }); + + // search more... if more results that max + if (values.length > self.limit) { + values = values.slice(0, self.limit); + values.push({ + label: _t("Search More..."), + action: function() { + dataset.name_search(search_val, self.build_domain(), 'ilike', false).done(function(data) { + self._search_create_popup("search", data); + }); + }, + classname: 'oe_m2o_dropdown_option' + }); + } + // quick create + + 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) { + + var raw_result = _(data.result).map(function(x) {return x[1];}); + if (search_val.length > 0 && !_.include(raw_result, search_val)) { + values.push({ + label: _.str.sprintf(_t('Create "%s"'), + $('').text(search_val).html()), + action: function() { + self._quick_create(search_val); + }, + classname: 'oe_m2o_dropdown_option' + }); + } + } + + // 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) { + + values.push({ + label: _t("Create and Edit..."), + action: function() { + self._search_create_popup("form", undefined, self._create_context(search_val)); + }, + classname: 'oe_m2o_dropdown_option' + }); + } + + return values; + }) + }, + }); +}; + diff --git a/web_m2x_options/views/view.xml b/web_m2x_options/views/view.xml new file mode 100644 index 000000000000..9628625b5103 --- /dev/null +++ b/web_m2x_options/views/view.xml @@ -0,0 +1,12 @@ + + + + + + + From 1fe71fa828c8901586dddd26e484183c3c2d5d2a Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Fri, 10 Jul 2015 15:39:06 +0200 Subject: [PATCH 04/67] support 'open' on many2many_tags [ADD] support 'no_open_edit' on many2one [FIX] typos --- web_m2x_options/README.rst | 91 +++++++++++++++++++------ web_m2x_options/__init__.py | 1 + web_m2x_options/__openerp__.py | 4 ++ web_m2x_options/static/src/js/form.js | 24 +++++++ web_m2x_options/static/src/xml/base.xml | 13 ++++ 5 files changed, 111 insertions(+), 22 deletions(-) create mode 100644 web_m2x_options/static/src/xml/base.xml diff --git a/web_m2x_options/README.rst b/web_m2x_options/README.rst index be6e76039157..de0adaac3d33 100644 --- a/web_m2x_options/README.rst +++ b/web_m2x_options/README.rst @@ -1,35 +1,35 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + ================================== Add new options for many2one field ================================== - -Description ------------ - This modules modifies "many2one" and "many2manytags" form widgets so as to add some new display control options. -**New: support many2manytags widget !** - -**New: support global option management with ir.config_parameter !** - Options provided includes possibility to remove "Create..." and/or "Create and Edit..." entries from many2one drop down. You can also change default number of proposition appearing in the drop-down. Or prevent the dialog box poping in case of validation error. If not specified, the module will avoid proposing any of the create options -if the current user have no permission rights to create the related object. +if the current user has no permission rights to create the related object. +Usage +===== -Requirements ------------- +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/162/8.0 -Was tested on openerp 8.0, trunk, saas-5 branch. New way to import js file. (thanks to tfossoul) +For further information, please visit: +* https://www.odoo.com/forum/help-1 -New options ------------ +in the field's options dict +--------------------------- ``create`` *boolean* (Default: depends if user have create rights) @@ -47,21 +47,27 @@ New options Number of displayed record in drop-down panel -``search_more`` *boolean* +``search_more`` *boolean* Used to force disable/enable search more button. - + ``field_color`` *string* A string to define the field used to define color. This option has to be used with colors. - + ``colors`` *dictionary* A dictionary to link field value with a HTML color. This option has to be used with field_color. - +``no_open_edit`` *boolean* (Default: value of ``no_open`` which is ``False`` if not set) + + Causes a many2one not to offer to click through in edit mode, but well in read mode + +``open`` *boolean* (Default: ``False``) + + Makes many2many_tags buttons that open the linked resource ir.config_parameter options --------------------------- @@ -107,9 +113,50 @@ Your XML form view definition could contain:: ... -Note ----- +Known issues +============ + +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. + +Roadmap +======= + +- Instead of making the tags rectangle clickable, I think it's better to put the text as a clickable link, so we will get a consistent behaviour/aspect with other clickable elements (many2one...). +- In edit mode, it would be great to add an icon like the one on many2one fields to allow to open the many2many in a popup window. +- Include this feature as a configurable option via parameter to have this behaviour by default in all many2many tags. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed feedback +`here `_. + +Credits +======= + +Contributors +------------ + +* David Coninckx +* Emanuel Cino +* Holger Brunn +* Nicolas JEUDY +* Yannick Vaucher + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. -Double check that you have no inherited view that remote ``options`` you set on a field ! -If nothing work, add a debugger in the first ligne of ``get_search_result method`` and enable debug mode in OpenERP. When you write something in a many2one field, javascript debugger should pause. If not verify your installation. +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. +To contribute to this module, please visit http://odoo-community.org. diff --git a/web_m2x_options/__init__.py b/web_m2x_options/__init__.py index e69de29bb2d1..57d631c3f004 100644 --- a/web_m2x_options/__init__.py +++ b/web_m2x_options/__init__.py @@ -0,0 +1 @@ +# coding: utf-8 diff --git a/web_m2x_options/__openerp__.py b/web_m2x_options/__openerp__.py index 37b7dbf4e770..c87994c71a61 100644 --- a/web_m2x_options/__openerp__.py +++ b/web_m2x_options/__openerp__.py @@ -7,6 +7,10 @@ 'base', 'web', ], + 'qweb': [ + 'static/src/xml/base.xml', + ], + 'license': 'AGPL-3', 'data': ['views/view.xml'], "author": "0k.io,Odoo Community Association (OCA)", "installable": True, diff --git a/web_m2x_options/static/src/js/form.js b/web_m2x_options/static/src/js/form.js index bc4d3bebd335..7342794ea2e5 100644 --- a/web_m2x_options/static/src/js/form.js +++ b/web_m2x_options/static/src/js/form.js @@ -336,6 +336,30 @@ openerp.web_m2x_options = function (instance) { return values; }) }, + + render_value: function() + { + var self = this; + return jQuery.when(this._super.apply(this, arguments)) + .then(function() + { + if(self.options.open) + { + self.$el.find('.oe_tag') + .css('cursor', 'pointer') + .click(function(e) + { + var id = parseInt(jQuery(this).attr('data-id')); + self.do_action({ + type: 'ir.actions.act_window', + res_model: self.field.relation, + views: [[false, 'form']], + res_id: id, + }); + }); + } + }); + }, }); }; diff --git a/web_m2x_options/static/src/xml/base.xml b/web_m2x_options/static/src/xml/base.xml new file mode 100644 index 000000000000..9fbf425eaadc --- /dev/null +++ b/web_m2x_options/static/src/xml/base.xml @@ -0,0 +1,13 @@ + + + + + jQuery(this).attr('t-if', '!(widget.options.no_open || widget.options.no_open_edit)'); + + + + + jQuery(this).attr('t-att-data-id', 'el[0]'); + + + From f969cc2b8f65a1206a7ff3de8ccb30449d083fc8 Mon Sep 17 00:00:00 2001 From: Antonio Espinosa Date: Mon, 16 Nov 2015 13:00:04 +0100 Subject: [PATCH 05/67] web_m2x_options check Many2one and Many2many options --- web_m2x_options/i18n/ar.po | 43 ++++++++++ web_m2x_options/i18n/de.po | 43 ++++++++++ web_m2x_options/i18n/es.po | 43 ++++++++++ web_m2x_options/i18n/fi.po | 43 ++++++++++ web_m2x_options/i18n/fr.po | 43 ++++++++++ web_m2x_options/i18n/it.po | 55 ++++++++++++ web_m2x_options/i18n/pt_BR.po | 43 ++++++++++ web_m2x_options/i18n/sl.po | 43 ++++++++++ web_m2x_options/i18n/tr.po | 44 ++++++++++ web_m2x_options/static/src/js/form.js | 117 +++++++++++++++----------- 10 files changed, 467 insertions(+), 50 deletions(-) create mode 100644 web_m2x_options/i18n/ar.po create mode 100644 web_m2x_options/i18n/de.po create mode 100644 web_m2x_options/i18n/es.po create mode 100644 web_m2x_options/i18n/fi.po create mode 100644 web_m2x_options/i18n/fr.po create mode 100644 web_m2x_options/i18n/it.po create mode 100644 web_m2x_options/i18n/pt_BR.po create mode 100644 web_m2x_options/i18n/sl.po create mode 100644 web_m2x_options/i18n/tr.po diff --git a/web_m2x_options/i18n/ar.po b/web_m2x_options/i18n/ar.po new file mode 100644 index 000000000000..1011622c21a8 --- /dev/null +++ b/web_m2x_options/i18n/ar.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +# Translators: +# SaFi J. , 2015 +msgid "" +msgstr "" +"Project-Id-Version: web (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-02-26 02:05+0000\n" +"PO-Revision-Date: 2015-12-16 17:30+0000\n" +"Last-Translator: SaFi J. \n" +"Language-Team: Arabic (http://www.transifex.com/oca/OCA-web-8-0/language/ar/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: ar\n" +"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:191 +#: code:addons/web_m2x_options/static/src/js/form.js:330 +#, python-format +msgid "Create \"%s\"" +msgstr "إنشاء \"%s\"" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:213 +#: code:addons/web_m2x_options/static/src/js/form.js:351 +#, python-format +msgid "Create and Edit..." +msgstr "إنشاء وتحرير ..." + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:156 +#: code:addons/web_m2x_options/static/src/js/form.js:305 +#, python-format +msgid "Search More..." +msgstr "البحث عن المزيد ..." diff --git a/web_m2x_options/i18n/de.po b/web_m2x_options/i18n/de.po new file mode 100644 index 000000000000..112e2b911061 --- /dev/null +++ b/web_m2x_options/i18n/de.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +# Translators: +# Rudolf Schnapka , 2016 +msgid "" +msgstr "" +"Project-Id-Version: web (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-02-26 02:05+0000\n" +"PO-Revision-Date: 2016-01-18 20:15+0000\n" +"Last-Translator: Rudolf Schnapka \n" +"Language-Team: German (http://www.transifex.com/oca/OCA-web-8-0/language/de/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: de\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:191 +#: code:addons/web_m2x_options/static/src/js/form.js:330 +#, python-format +msgid "Create \"%s\"" +msgstr "Anlegen \"%s" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:213 +#: code:addons/web_m2x_options/static/src/js/form.js:351 +#, python-format +msgid "Create and Edit..." +msgstr "Anlegen und Bearbeiten" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:156 +#: code:addons/web_m2x_options/static/src/js/form.js:305 +#, python-format +msgid "Search More..." +msgstr "Suche weitere..." diff --git a/web_m2x_options/i18n/es.po b/web_m2x_options/i18n/es.po new file mode 100644 index 000000000000..7a4764bae86a --- /dev/null +++ b/web_m2x_options/i18n/es.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +# Translators: +# Pedro M. Baeza , 2015 +msgid "" +msgstr "" +"Project-Id-Version: web (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-02-26 02:05+0000\n" +"PO-Revision-Date: 2015-11-07 11:28+0000\n" +"Last-Translator: Pedro M. Baeza \n" +"Language-Team: Spanish (http://www.transifex.com/oca/OCA-web-8-0/language/es/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: es\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:191 +#: code:addons/web_m2x_options/static/src/js/form.js:330 +#, python-format +msgid "Create \"%s\"" +msgstr "Crear \"%s\"" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:213 +#: code:addons/web_m2x_options/static/src/js/form.js:351 +#, python-format +msgid "Create and Edit..." +msgstr "Crear y editar..." + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:156 +#: code:addons/web_m2x_options/static/src/js/form.js:305 +#, python-format +msgid "Search More..." +msgstr "Buscar más..." diff --git a/web_m2x_options/i18n/fi.po b/web_m2x_options/i18n/fi.po new file mode 100644 index 000000000000..9dab4ae40247 --- /dev/null +++ b/web_m2x_options/i18n/fi.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +# Translators: +# Jarmo Kortetjärvi , 2016 +msgid "" +msgstr "" +"Project-Id-Version: web (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-02-26 02:05+0000\n" +"PO-Revision-Date: 2016-02-01 09:52+0000\n" +"Last-Translator: Jarmo Kortetjärvi \n" +"Language-Team: Finnish (http://www.transifex.com/oca/OCA-web-8-0/language/fi/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: fi\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:191 +#: code:addons/web_m2x_options/static/src/js/form.js:330 +#, python-format +msgid "Create \"%s\"" +msgstr "Luo \"%s\"" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:213 +#: code:addons/web_m2x_options/static/src/js/form.js:351 +#, python-format +msgid "Create and Edit..." +msgstr "Luo ja muokkaa..." + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:156 +#: code:addons/web_m2x_options/static/src/js/form.js:305 +#, python-format +msgid "Search More..." +msgstr "Hae lisää..." diff --git a/web_m2x_options/i18n/fr.po b/web_m2x_options/i18n/fr.po new file mode 100644 index 000000000000..448e0f4684ff --- /dev/null +++ b/web_m2x_options/i18n/fr.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +# Translators: +# Christophe CHAUVET , 2016 +msgid "" +msgstr "" +"Project-Id-Version: web (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-05-06 15:50+0000\n" +"PO-Revision-Date: 2016-05-06 08:27+0000\n" +"Last-Translator: Christophe CHAUVET \n" +"Language-Team: French (http://www.transifex.com/oca/OCA-web-8-0/language/fr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: fr\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:191 +#: code:addons/web_m2x_options/static/src/js/form.js:330 +#, python-format +msgid "Create \"%s\"" +msgstr "Creer \"%s\"" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:213 +#: code:addons/web_m2x_options/static/src/js/form.js:351 +#, python-format +msgid "Create and Edit..." +msgstr "Créer et modifier..." + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:156 +#: code:addons/web_m2x_options/static/src/js/form.js:305 +#, python-format +msgid "Search More..." +msgstr "Rechercher plus..." diff --git a/web_m2x_options/i18n/it.po b/web_m2x_options/i18n/it.po new file mode 100644 index 000000000000..ce21776cee13 --- /dev/null +++ b/web_m2x_options/i18n/it.po @@ -0,0 +1,55 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +# Translators: +# Ahmet Altınışık , 2015 +# Antonio Trueba, 2016 +# Armando Vulcano Junior , 2015 +# Carles Antoli , 2015 +# Bole , 2015 +# FIRST AUTHOR , 2012,2014 +# Giacomo , 2015 +# Hotellook, 2014 +# Jarmo Kortetjärvi , 2016 +# Paolo Valier, 2016 +# Paolo Valier, 2016 +# Rudolf Schnapka , 2016 +# Thomas A. Jaeger, 2015 +msgid "" +msgstr "" +"Project-Id-Version: web (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-04-28 07:09+0000\n" +"PO-Revision-Date: 2016-04-28 06:46+0000\n" +"Last-Translator: Paolo Valier\n" +"Language-Team: Italian (http://www.transifex.com/oca/OCA-web-8-0/language/it/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: it\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:191 +#: code:addons/web_m2x_options/static/src/js/form.js:330 +#, python-format +msgid "Create \"%s\"" +msgstr "Crea \"%s\"" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:213 +#: code:addons/web_m2x_options/static/src/js/form.js:351 +#, python-format +msgid "Create and Edit..." +msgstr "Crea e Modifica..." + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:156 +#: code:addons/web_m2x_options/static/src/js/form.js:305 +#, python-format +msgid "Search More..." +msgstr "Cerca altro..." diff --git a/web_m2x_options/i18n/pt_BR.po b/web_m2x_options/i18n/pt_BR.po new file mode 100644 index 000000000000..8074af4c14d7 --- /dev/null +++ b/web_m2x_options/i18n/pt_BR.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +# Translators: +# danimaribeiro , 2016 +msgid "" +msgstr "" +"Project-Id-Version: web (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-03-11 02:17+0000\n" +"PO-Revision-Date: 2016-03-05 16:20+0000\n" +"Last-Translator: danimaribeiro \n" +"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-web-8-0/language/pt_BR/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: pt_BR\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:191 +#: code:addons/web_m2x_options/static/src/js/form.js:330 +#, python-format +msgid "Create \"%s\"" +msgstr "Criar \"%s\"" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:213 +#: code:addons/web_m2x_options/static/src/js/form.js:351 +#, python-format +msgid "Create and Edit..." +msgstr "Criar e editar.." + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:156 +#: code:addons/web_m2x_options/static/src/js/form.js:305 +#, python-format +msgid "Search More..." +msgstr "Buscar mais..." diff --git a/web_m2x_options/i18n/sl.po b/web_m2x_options/i18n/sl.po new file mode 100644 index 000000000000..c63f36ed9d72 --- /dev/null +++ b/web_m2x_options/i18n/sl.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +# Translators: +# Matjaž Mozetič , 2015 +msgid "" +msgstr "" +"Project-Id-Version: web (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-02-26 02:05+0000\n" +"PO-Revision-Date: 2015-11-08 05:46+0000\n" +"Last-Translator: Matjaž Mozetič \n" +"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-web-8-0/language/sl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: sl\n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:191 +#: code:addons/web_m2x_options/static/src/js/form.js:330 +#, python-format +msgid "Create \"%s\"" +msgstr "Ustvari \"%s\"" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:213 +#: code:addons/web_m2x_options/static/src/js/form.js:351 +#, python-format +msgid "Create and Edit..." +msgstr "Ustvari in urejaj..." + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:156 +#: code:addons/web_m2x_options/static/src/js/form.js:305 +#, python-format +msgid "Search More..." +msgstr "Poišči več..." diff --git a/web_m2x_options/i18n/tr.po b/web_m2x_options/i18n/tr.po new file mode 100644 index 000000000000..c9418f2d1c2f --- /dev/null +++ b/web_m2x_options/i18n/tr.po @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +# Translators: +# Ahmet Altınışık , 2015 +# Ahmet Altınışık , 2015 +msgid "" +msgstr "" +"Project-Id-Version: web (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-02-26 02:05+0000\n" +"PO-Revision-Date: 2015-12-30 21:53+0000\n" +"Last-Translator: Ahmet Altınışık \n" +"Language-Team: Turkish (http://www.transifex.com/oca/OCA-web-8-0/language/tr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: tr\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:191 +#: code:addons/web_m2x_options/static/src/js/form.js:330 +#, python-format +msgid "Create \"%s\"" +msgstr "Oluştur \"%s\"" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:213 +#: code:addons/web_m2x_options/static/src/js/form.js:351 +#, python-format +msgid "Create and Edit..." +msgstr "Oluştur ve düzenle..." + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:156 +#: code:addons/web_m2x_options/static/src/js/form.js:305 +#, python-format +msgid "Search More..." +msgstr "Daha Fazla..." diff --git a/web_m2x_options/static/src/js/form.js b/web_m2x_options/static/src/js/form.js index 7342794ea2e5..524197a57392 100644 --- a/web_m2x_options/static/src/js/form.js +++ b/web_m2x_options/static/src/js/form.js @@ -67,11 +67,11 @@ openerp.web_m2x_options = function (instance) { var self = this; // add options limit used to change number of selections record // returned. - if (_.isUndefined(this.view)) - return this._super.apply(this, arguments); - if (!_.isUndefined(this.view.ir_options['web_m2x_options.limit'])) { - this.limit = parseInt(this.view.ir_options['web_m2x_options.limit']); - } + if (_.isUndefined(this.view)) + return this._super.apply(this, arguments); + if (!_.isUndefined(this.view.ir_options['web_m2x_options.limit'])) { + this.limit = parseInt(this.view.ir_options['web_m2x_options.limit']); + } if (typeof this.options.limit === 'number') { this.limit = this.options.limit; @@ -99,8 +99,7 @@ openerp.web_m2x_options = function (instance) { self.build_context())); 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( "check_access_rights", ["create", false]); } @@ -119,7 +118,7 @@ openerp.web_m2x_options = function (instance) { id: x[0], }; }); - + // Search result value colors if (self.colors && self.field_color) { @@ -127,7 +126,7 @@ openerp.web_m2x_options = function (instance) { for (var index in values) { value_ids.push(values[index].id); } - + // RPC request to get field_color from Objects Objects.query([self.field_color]) .filter([['id', 'in', value_ids]]) @@ -137,7 +136,7 @@ openerp.web_m2x_options = function (instance) { if (values[index_value].id == objects[index].id) { // Find value in values by comparing ids var value = values[index_value]; - + // Find color with field value as key var color = self.colors[objects[index][self.field_color]] || 'black'; value.label = ''+value.label+''; @@ -171,10 +170,15 @@ openerp.web_m2x_options = function (instance) { var raw_result = _(data.result).map(function (x) { 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 && !_.include(raw_result, search_val)) { @@ -192,10 +196,15 @@ openerp.web_m2x_options = function (instance) { } // 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({ label: _t("Create and Edit..."), @@ -207,7 +216,7 @@ openerp.web_m2x_options = function (instance) { classname: 'oe_m2o_dropdown_option' }); } - + // Check if colors specified to wait for RPC if (!(self.field_color && self.colors)){ def.resolve(values); @@ -226,28 +235,28 @@ openerp.web_m2x_options = function (instance) { new instance.web.form.M2ODialog(this).open(); } }, - - start: function() { - this._super.apply(this, arguments); - return this.get_options(); - }, - - get_options: function() { - var self = this; - if (_.isUndefined(this.view.ir_options_loaded)) { - this.view.ir_options_loaded = $.Deferred(); - this.view.ir_options = {}; - (new instance.web.Model("ir.config_parameter")) - .query(["key", "value"]).filter([['key', 'in', OPTIONS]]) - .all().then(function(records) { - _(records).each(function(record) { - self.view.ir_options[record.key] = record.value; - }); - self.view.ir_options_loaded.resolve(); - }); - } - return this.view.ir_options_loaded; - }, + + start: function() { + this._super.apply(this, arguments); + return this.get_options(); + }, + + get_options: function() { + var self = this; + if (_.isUndefined(this.view.ir_options_loaded)) { + this.view.ir_options_loaded = $.Deferred(); + this.view.ir_options = {}; + (new instance.web.Model("ir.config_parameter")) + .query(["key", "value"]).filter([['key', 'in', OPTIONS]]) + .all().then(function(records) { + _(records).each(function(record) { + self.view.ir_options[record.key] = record.value; + }); + self.view.ir_options_loaded.resolve(); + }); + } + return this.view.ir_options_loaded; + }, /** * Call this method to search using a string. @@ -258,10 +267,10 @@ openerp.web_m2x_options = function (instance) { // add options limit used to change number of selections record // returned. - - if (!_.isUndefined(this.view.ir_options['web_m2x_options.limit'])) { - this.limit = parseInt(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']); + } if (typeof this.options.limit === 'number') { this.limit = this.options.limit; @@ -300,10 +309,14 @@ openerp.web_m2x_options = function (instance) { }); } // 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 || m2x_create)) { var raw_result = _(data.result).map(function(x) {return x[1];}); if (search_val.length > 0 && !_.include(raw_result, search_val)) { @@ -319,10 +332,14 @@ openerp.web_m2x_options = function (instance) { } // 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 || m2x_create_edit)) { values.push({ label: _t("Create and Edit..."), From 89088e35756f0b40d37ae2ac5bf52b2eec189009 Mon Sep 17 00:00:00 2001 From: Antonio Espinosa Date: Wed, 10 Feb 2016 17:05:51 +0100 Subject: [PATCH 06/67] Limit name_search to 160 like Odoo core does --- web_m2x_options/__openerp__.py | 2 +- web_m2x_options/static/src/js/form.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/web_m2x_options/__openerp__.py b/web_m2x_options/__openerp__.py index c87994c71a61..8a3331574bce 100644 --- a/web_m2x_options/__openerp__.py +++ b/web_m2x_options/__openerp__.py @@ -2,7 +2,7 @@ { "name": 'web_m2x_options', - "version": "8.0.0.2", + "version": "8.0.0.2.0", "depends": [ 'base', 'web', diff --git a/web_m2x_options/static/src/js/form.js b/web_m2x_options/static/src/js/form.js index 524197a57392..9fe51d23b056 100644 --- a/web_m2x_options/static/src/js/form.js +++ b/web_m2x_options/static/src/js/form.js @@ -155,9 +155,12 @@ openerp.web_m2x_options = function (instance) { values.push({ label: _t("Search More..."), action: function () { + // limit = 80 for improving performance, similar + // to Odoo implementation here: + // https://github.com/odoo/odoo/commit/8c3cdce539d87775b59b3f2d5ceb433f995821bf dataset.name_search( search_val, self.build_domain(), - 'ilike', false).done(function (data) { + 'ilike', 80).done(function (data) { self._search_create_popup("search", data); }); }, @@ -301,7 +304,10 @@ openerp.web_m2x_options = function (instance) { values.push({ label: _t("Search More..."), action: function() { - dataset.name_search(search_val, self.build_domain(), 'ilike', false).done(function(data) { + // limit = 80 for improving performance, similar + // to Odoo implementation here: + // https://github.com/odoo/odoo/commit/8c3cdce539d87775b59b3f2d5ceb433f995821bf + dataset.name_search(search_val, self.build_domain(), 'ilike', 80).done(function(data) { self._search_create_popup("search", data); }); }, From b1a35f7f35dc11884e51c40c8f8523770bef55d6 Mon Sep 17 00:00:00 2001 From: Zakaria Makrelouf Date: Sun, 11 Sep 2016 12:10:19 +0100 Subject: [PATCH 07/67] Migration of module web_m2x_options. Adapt JS file to the new JS API and make the module installable [MIG] adapt form.js to the new API. [FIX] Fix bug mentioned in pull #262. [MIG] Make the module installable. --- web_m2x_options/README.rst | 1 + web_m2x_options/__openerp__.py | 7 +- web_m2x_options/i18n/ar.po | 12 +- web_m2x_options/i18n/de.po | 12 +- web_m2x_options/i18n/es.po | 12 +- web_m2x_options/i18n/fi.po | 12 +- web_m2x_options/i18n/fr.po | 12 +- web_m2x_options/i18n/it.po | 12 +- web_m2x_options/i18n/pt_BR.po | 12 +- web_m2x_options/i18n/sl.po | 12 +- web_m2x_options/i18n/tr.po | 12 +- web_m2x_options/static/src/js/form.js | 225 ++++++++++++++---------- web_m2x_options/static/src/xml/base.xml | 2 +- 13 files changed, 190 insertions(+), 153 deletions(-) diff --git a/web_m2x_options/README.rst b/web_m2x_options/README.rst index de0adaac3d33..dff75f05fe73 100644 --- a/web_m2x_options/README.rst +++ b/web_m2x_options/README.rst @@ -145,6 +145,7 @@ Contributors * Holger Brunn * Nicolas JEUDY * Yannick Vaucher +* Zakaria Makrelouf Maintainer ---------- diff --git a/web_m2x_options/__openerp__.py b/web_m2x_options/__openerp__.py index 8a3331574bce..94c1a525bd55 100644 --- a/web_m2x_options/__openerp__.py +++ b/web_m2x_options/__openerp__.py @@ -2,7 +2,7 @@ { "name": 'web_m2x_options', - "version": "8.0.0.2.0", + "version": "9.0.1.0.0", "depends": [ 'base', 'web', @@ -12,7 +12,6 @@ ], 'license': 'AGPL-3', 'data': ['views/view.xml'], - "author": "0k.io,Odoo Community Association (OCA)", - "installable": True, - "active": False, + "author": "ACSONE SA/NV, 0k.io,Odoo Community Association (OCA)", + 'installable': True, } diff --git a/web_m2x_options/i18n/ar.po b/web_m2x_options/i18n/ar.po index 1011622c21a8..124f84ceecdc 100644 --- a/web_m2x_options/i18n/ar.po +++ b/web_m2x_options/i18n/ar.po @@ -20,24 +20,24 @@ msgstr "" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:191 -#: code:addons/web_m2x_options/static/src/js/form.js:330 +#: code:addons/web_m2x_options/static/src/js/form.js:219 +#: code:addons/web_m2x_options/static/src/js/form.js:373 #, python-format msgid "Create \"%s\"" msgstr "إنشاء \"%s\"" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:213 -#: code:addons/web_m2x_options/static/src/js/form.js:351 +#: code:addons/web_m2x_options/static/src/js/form.js:237 +#: code:addons/web_m2x_options/static/src/js/form.js:392 #, python-format msgid "Create and Edit..." msgstr "إنشاء وتحرير ..." #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:156 -#: code:addons/web_m2x_options/static/src/js/form.js:305 +#: code:addons/web_m2x_options/static/src/js/form.js:188 +#: code:addons/web_m2x_options/static/src/js/form.js:349 #, python-format msgid "Search More..." msgstr "البحث عن المزيد ..." diff --git a/web_m2x_options/i18n/de.po b/web_m2x_options/i18n/de.po index 112e2b911061..40eb8cacde07 100644 --- a/web_m2x_options/i18n/de.po +++ b/web_m2x_options/i18n/de.po @@ -20,24 +20,24 @@ msgstr "" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:191 -#: code:addons/web_m2x_options/static/src/js/form.js:330 +#: code:addons/web_m2x_options/static/src/js/form.js:219 +#: code:addons/web_m2x_options/static/src/js/form.js:373 #, python-format msgid "Create \"%s\"" msgstr "Anlegen \"%s" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:213 -#: code:addons/web_m2x_options/static/src/js/form.js:351 +#: code:addons/web_m2x_options/static/src/js/form.js:237 +#: code:addons/web_m2x_options/static/src/js/form.js:392 #, python-format msgid "Create and Edit..." msgstr "Anlegen und Bearbeiten" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:156 -#: code:addons/web_m2x_options/static/src/js/form.js:305 +#: code:addons/web_m2x_options/static/src/js/form.js:188 +#: code:addons/web_m2x_options/static/src/js/form.js:349 #, python-format msgid "Search More..." msgstr "Suche weitere..." diff --git a/web_m2x_options/i18n/es.po b/web_m2x_options/i18n/es.po index 7a4764bae86a..bd3b1e51bc9d 100644 --- a/web_m2x_options/i18n/es.po +++ b/web_m2x_options/i18n/es.po @@ -20,24 +20,24 @@ msgstr "" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:191 -#: code:addons/web_m2x_options/static/src/js/form.js:330 +#: code:addons/web_m2x_options/static/src/js/form.js:219 +#: code:addons/web_m2x_options/static/src/js/form.js:373 #, python-format msgid "Create \"%s\"" msgstr "Crear \"%s\"" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:213 -#: code:addons/web_m2x_options/static/src/js/form.js:351 +#: code:addons/web_m2x_options/static/src/js/form.js:237 +#: code:addons/web_m2x_options/static/src/js/form.js:392 #, python-format msgid "Create and Edit..." msgstr "Crear y editar..." #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:156 -#: code:addons/web_m2x_options/static/src/js/form.js:305 +#: code:addons/web_m2x_options/static/src/js/form.js:188 +#: code:addons/web_m2x_options/static/src/js/form.js:349 #, python-format msgid "Search More..." msgstr "Buscar más..." diff --git a/web_m2x_options/i18n/fi.po b/web_m2x_options/i18n/fi.po index 9dab4ae40247..b374d7eb9458 100644 --- a/web_m2x_options/i18n/fi.po +++ b/web_m2x_options/i18n/fi.po @@ -20,24 +20,24 @@ msgstr "" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:191 -#: code:addons/web_m2x_options/static/src/js/form.js:330 +#: code:addons/web_m2x_options/static/src/js/form.js:219 +#: code:addons/web_m2x_options/static/src/js/form.js:373 #, python-format msgid "Create \"%s\"" msgstr "Luo \"%s\"" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:213 -#: code:addons/web_m2x_options/static/src/js/form.js:351 +#: code:addons/web_m2x_options/static/src/js/form.js:237 +#: code:addons/web_m2x_options/static/src/js/form.js:392 #, python-format msgid "Create and Edit..." msgstr "Luo ja muokkaa..." #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:156 -#: code:addons/web_m2x_options/static/src/js/form.js:305 +#: code:addons/web_m2x_options/static/src/js/form.js:188 +#: code:addons/web_m2x_options/static/src/js/form.js:349 #, python-format msgid "Search More..." msgstr "Hae lisää..." diff --git a/web_m2x_options/i18n/fr.po b/web_m2x_options/i18n/fr.po index 448e0f4684ff..3be5ae233eab 100644 --- a/web_m2x_options/i18n/fr.po +++ b/web_m2x_options/i18n/fr.po @@ -20,24 +20,24 @@ msgstr "" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:191 -#: code:addons/web_m2x_options/static/src/js/form.js:330 +#: code:addons/web_m2x_options/static/src/js/form.js:219 +#: code:addons/web_m2x_options/static/src/js/form.js:373 #, python-format msgid "Create \"%s\"" msgstr "Creer \"%s\"" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:213 -#: code:addons/web_m2x_options/static/src/js/form.js:351 +#: code:addons/web_m2x_options/static/src/js/form.js:237 +#: code:addons/web_m2x_options/static/src/js/form.js:392 #, python-format msgid "Create and Edit..." msgstr "Créer et modifier..." #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:156 -#: code:addons/web_m2x_options/static/src/js/form.js:305 +#: code:addons/web_m2x_options/static/src/js/form.js:188 +#: code:addons/web_m2x_options/static/src/js/form.js:349 #, python-format msgid "Search More..." msgstr "Rechercher plus..." diff --git a/web_m2x_options/i18n/it.po b/web_m2x_options/i18n/it.po index ce21776cee13..c8db1568fdf7 100644 --- a/web_m2x_options/i18n/it.po +++ b/web_m2x_options/i18n/it.po @@ -32,24 +32,24 @@ msgstr "" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:191 -#: code:addons/web_m2x_options/static/src/js/form.js:330 +#: code:addons/web_m2x_options/static/src/js/form.js:219 +#: code:addons/web_m2x_options/static/src/js/form.js:373 #, python-format msgid "Create \"%s\"" msgstr "Crea \"%s\"" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:213 -#: code:addons/web_m2x_options/static/src/js/form.js:351 +#: code:addons/web_m2x_options/static/src/js/form.js:237 +#: code:addons/web_m2x_options/static/src/js/form.js:392 #, python-format msgid "Create and Edit..." msgstr "Crea e Modifica..." #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:156 -#: code:addons/web_m2x_options/static/src/js/form.js:305 +#: code:addons/web_m2x_options/static/src/js/form.js:188 +#: code:addons/web_m2x_options/static/src/js/form.js:349 #, python-format msgid "Search More..." msgstr "Cerca altro..." diff --git a/web_m2x_options/i18n/pt_BR.po b/web_m2x_options/i18n/pt_BR.po index 8074af4c14d7..cf28995e3eed 100644 --- a/web_m2x_options/i18n/pt_BR.po +++ b/web_m2x_options/i18n/pt_BR.po @@ -20,24 +20,24 @@ msgstr "" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:191 -#: code:addons/web_m2x_options/static/src/js/form.js:330 +#: code:addons/web_m2x_options/static/src/js/form.js:219 +#: code:addons/web_m2x_options/static/src/js/form.js:373 #, python-format msgid "Create \"%s\"" msgstr "Criar \"%s\"" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:213 -#: code:addons/web_m2x_options/static/src/js/form.js:351 +#: code:addons/web_m2x_options/static/src/js/form.js:237 +#: code:addons/web_m2x_options/static/src/js/form.js:392 #, python-format msgid "Create and Edit..." msgstr "Criar e editar.." #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:156 -#: code:addons/web_m2x_options/static/src/js/form.js:305 +#: code:addons/web_m2x_options/static/src/js/form.js:188 +#: code:addons/web_m2x_options/static/src/js/form.js:349 #, python-format msgid "Search More..." msgstr "Buscar mais..." diff --git a/web_m2x_options/i18n/sl.po b/web_m2x_options/i18n/sl.po index c63f36ed9d72..7192762e128e 100644 --- a/web_m2x_options/i18n/sl.po +++ b/web_m2x_options/i18n/sl.po @@ -20,24 +20,24 @@ msgstr "" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:191 -#: code:addons/web_m2x_options/static/src/js/form.js:330 +#: code:addons/web_m2x_options/static/src/js/form.js:219 +#: code:addons/web_m2x_options/static/src/js/form.js:373 #, python-format msgid "Create \"%s\"" msgstr "Ustvari \"%s\"" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:213 -#: code:addons/web_m2x_options/static/src/js/form.js:351 +#: code:addons/web_m2x_options/static/src/js/form.js:237 +#: code:addons/web_m2x_options/static/src/js/form.js:392 #, python-format msgid "Create and Edit..." msgstr "Ustvari in urejaj..." #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:156 -#: code:addons/web_m2x_options/static/src/js/form.js:305 +#: code:addons/web_m2x_options/static/src/js/form.js:188 +#: code:addons/web_m2x_options/static/src/js/form.js:349 #, python-format msgid "Search More..." msgstr "Poišči več..." diff --git a/web_m2x_options/i18n/tr.po b/web_m2x_options/i18n/tr.po index c9418f2d1c2f..2b9f46fdd2ee 100644 --- a/web_m2x_options/i18n/tr.po +++ b/web_m2x_options/i18n/tr.po @@ -21,24 +21,24 @@ msgstr "" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:191 -#: code:addons/web_m2x_options/static/src/js/form.js:330 +#: code:addons/web_m2x_options/static/src/js/form.js:219 +#: code:addons/web_m2x_options/static/src/js/form.js:373 #, python-format msgid "Create \"%s\"" msgstr "Oluştur \"%s\"" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:213 -#: code:addons/web_m2x_options/static/src/js/form.js:351 +#: code:addons/web_m2x_options/static/src/js/form.js:237 +#: code:addons/web_m2x_options/static/src/js/form.js:392 #, python-format msgid "Create and Edit..." msgstr "Oluştur ve düzenle..." #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:156 -#: code:addons/web_m2x_options/static/src/js/form.js:305 +#: code:addons/web_m2x_options/static/src/js/form.js:188 +#: code:addons/web_m2x_options/static/src/js/form.js:349 #, python-format msgid "Search More..." msgstr "Daha Fazla..." diff --git a/web_m2x_options/static/src/js/form.js b/web_m2x_options/static/src/js/form.js index 9fe51d23b056..8e97ad3ecb1d 100644 --- a/web_m2x_options/static/src/js/form.js +++ b/web_m2x_options/static/src/js/form.js @@ -1,12 +1,17 @@ -/*global openerp, _, $ */ - -openerp.web_m2x_options = function (instance) { +/* Copyright 2016 0k.io,ACSONE SA/NV + * * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ +odoo.define('web_m2x_options.web_m2x_options', function (require) { "use strict"; - var QWeb = instance.web.qweb, - _t = instance.web._t, - _lt = instance.web._lt; + var $ = require("$"); + var core = require('web.core'), + data = require('web.data'), + Dialog = require('web.Dialog'), + Model = require('web.Model'), + form_relational = require('web.form_relational'), + _ = require('_'), + _t = core._t; var OPTIONS = ['web_m2x_options.create', 'web_m2x_options.create_edit', @@ -14,7 +19,40 @@ openerp.web_m2x_options = function (instance) { 'web_m2x_options.search_more', 'web_m2x_options.m2o_dialog',]; - instance.web.form.FieldMany2One = instance.web.form.FieldMany2One.extend({ + var M2ODialog = Dialog.extend({ + template: "M2ODialog", + init: function(parent) { + this.name = parent.string; + this._super(parent, { + title: _.str.sprintf(_t("Create a %s"), parent.string), + size: 'medium', + buttons: [ + {text: _t('Create'), classes: 'btn-primary', click: function() { + if (this.$("input").val() !== ''){ + this.getParent()._quick_create(this.$("input").val()); + this.close(); + } else { + e.preventDefault(); + this.$("input").focus(); + } + }}, + + {text: _t('Create and edit'), classes: 'btn-primary', close: true, click: function() { + this.getParent()._search_create_popup("form", undefined, this.getParent()._create_context(this.$("input").val())); + }}, + + {text: _t('Cancel'), close: true} + ] + }); + }, + start: function() { + var text = _.str.sprintf(_t("You are creating a new %s, are you sure it does not exist yet?"), this.name); + this.$("p").text(text); + this.$("input").val(this.getParent().$input.val()); + }, + }); + + form_relational.FieldMany2One.include({ start: function() { this._super.apply(this, arguments); @@ -26,7 +64,7 @@ openerp.web_m2x_options = function (instance) { if (!_.isUndefined(this.view) && _.isUndefined(this.view.ir_options_loaded)) { this.view.ir_options_loaded = $.Deferred(); this.view.ir_options = {}; - (new instance.web.Model("ir.config_parameter")) + (new Model("ir.config_parameter")) .query(["key", "value"]).filter([['key', 'in', OPTIONS]]) .all().then(function(records) { _(records).each(function(record) { @@ -57,12 +95,12 @@ openerp.web_m2x_options = function (instance) { if(this.is_option_set(this.options.m2o_dialog) || _.isUndefined(this.options.m2o_dialog) && this.is_option_set(this.view.ir_options['web_m2x_options.m2o_dialog']) || this.can_create && _.isUndefined(this.options.m2o_dialog) && _.isUndefined(this.view.ir_options['web_m2x_options.m2o_dialog'])) { - new instance.web.form.M2ODialog(this).open(); + new M2ODialog(this).open(); } }, get_search_result: function (search_val) { - var Objects = new instance.web.Model(this.field.relation); + var Objects = new Model(this.field.relation); var def = $.Deferred(); var self = this; // add options limit used to change number of selections record @@ -77,30 +115,25 @@ openerp.web_m2x_options = function (instance) { this.limit = this.options.limit; } - // add options search_more to force enable or disable search_more button - if (this.is_option_set(this.options.search_more) || _.isUndefined(this.options.search_more) && this.is_option_set(self.view.ir_options['web_m2x_options.search_more'])) { - this.search_more = true - } - // add options field_color and colors to color item(s) depending on field_color value this.field_color = this.options.field_color this.colors = this.options.colors - var dataset = new instance.web.DataSet(this, this.field.relation, + var dataset = new data.DataSet(this, this.field.relation, self.build_context()); var blacklist = this.get_search_blacklist(); this.last_query = search_val; var search_result = this.orderer.add(dataset.name_search( search_val, - new instance.web.CompoundDomain( + new data.CompoundDomain( self.build_domain(), [["id", "not in", blacklist]]), 'ilike', this.limit + 1, self.build_context())); var create_rights; - if (!(self.options && (self.options.no_create || self.options.no_create_edit))) { - create_rights = new instance.web.Model(this.field.relation).call( + 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( "check_access_rights", ["create", false]); } @@ -120,13 +153,11 @@ openerp.web_m2x_options = function (instance) { }); // Search result value colors - if (self.colors && self.field_color) { var value_ids = []; for (var index in values) { value_ids.push(values[index].id); } - // RPC request to get field_color from Objects Objects.query([self.field_color]) .filter([['id', 'in', value_ids]]) @@ -136,7 +167,6 @@ openerp.web_m2x_options = function (instance) { if (values[index_value].id == objects[index].id) { // Find value in values by comparing ids var value = values[index_value]; - // Find color with field value as key var color = self.colors[objects[index][self.field_color]] || 'black'; value.label = ''+value.label+''; @@ -149,8 +179,11 @@ openerp.web_m2x_options = function (instance) { } // search more... if more results that max + var can_search_more = (self.options && self.is_option_set(self.options.search_more)), + search_more_undef = _.isUndefined(self.options.search_more) && _.isUndefined(self.view.ir_options['web_m2x_options.search_more']), + search_more = self.is_option_set(self.view.ir_options['web_m2x_options.search_more']); - if (values.length > self.limit || self.search_more) { + if (values.length > self.limit && (can_search_more || search_more_undef || search_more)) { values = values.slice(0, self.limit); values.push({ label: _t("Search More..."), @@ -164,7 +197,7 @@ openerp.web_m2x_options = function (instance) { self._search_create_popup("search", data); }); }, - classname: 'oe_m2o_dropdown_option' + classname: 'oe_m2o_dropdown_option o_m2o_dropdown_option' }); } @@ -173,16 +206,12 @@ openerp.web_m2x_options = function (instance) { var raw_result = _(data.result).map(function (x) { 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 (!no_quick_create && ((m2x_create_undef && can_create) || - m2x_create)) { - + var quick_create = self.is_option_set(self.options.create) || self.is_option_set(self.options.quick_create), + quick_create_undef = _.isUndefined(self.options.create) && _.isUndefined(self.options.quick_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']); + 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 (search_val.length > 0 && !_.include(raw_result, search_val)) { @@ -193,22 +222,18 @@ openerp.web_m2x_options = function (instance) { action: function () { self._quick_create(search_val); }, - classname: 'oe_m2o_dropdown_option' + classname: 'oe_m2o_dropdown_option o_m2o_dropdown_option' }); } } // 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 (!no_create_edit && ((m2x_create_edit_undef && can_create) || - m2x_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), + 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']); + 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){ values.push({ label: _t("Create and Edit..."), action: function () { @@ -216,10 +241,9 @@ openerp.web_m2x_options = function (instance) { "form", undefined, self._create_context(search_val)); }, - classname: 'oe_m2o_dropdown_option' + classname: 'oe_m2o_dropdown_option o_m2o_dropdown_option' }); } - // Check if colors specified to wait for RPC if (!(self.field_color && self.colors)){ def.resolve(values); @@ -230,12 +254,19 @@ openerp.web_m2x_options = function (instance) { } }); - instance.web.form.FieldMany2ManyTags.include({ - + form_relational.FieldMany2ManyTags.include({ + events: { + 'click .o_delete': function(e) { + this.remove_id($(e.target).parent().data('id')); + }, + 'click .badge': 'open_badge', + 'mousedown .o_colorpicker span': 'update_color', + 'focusout .o_colorpicker': 'close_color_picker', + }, show_error_displayer: function () { if ((typeof this.options.m2o_dialog === 'undefined' && this.can_create) || this.options.m2o_dialog) { - new instance.web.form.M2ODialog(this).open(); + new M2ODialog(this).open(); } }, @@ -249,7 +280,7 @@ openerp.web_m2x_options = function (instance) { if (_.isUndefined(this.view.ir_options_loaded)) { this.view.ir_options_loaded = $.Deferred(); this.view.ir_options = {}; - (new instance.web.Model("ir.config_parameter")) + (new Model("ir.config_parameter")) .query(["key", "value"]).filter([['key', 'in', OPTIONS]]) .all().then(function(records) { _(records).each(function(record) { @@ -261,6 +292,20 @@ openerp.web_m2x_options = function (instance) { return this.view.ir_options_loaded; }, + is_option_set: function(option) { + if (_.isUndefined(option)) { + return false + } + var is_string = typeof option === 'string' + var is_bool = typeof option === 'boolean' + if (is_string) { + return option === 'true' || option === 'True' + } else if (is_bool) { + return option + } + return false + }, + /** * Call this method to search using a string. */ @@ -279,12 +324,12 @@ openerp.web_m2x_options = function (instance) { this.limit = this.options.limit; } - var dataset = new instance.web.DataSet(this, this.field.relation, self.build_context()); + var dataset = new data.DataSet(this, this.field.relation, self.build_context()); var blacklist = this.get_search_blacklist(); this.last_query = search_val; return this.orderer.add(dataset.name_search( - search_val, new instance.web.CompoundDomain(self.build_domain(), [["id", "not in", blacklist]]), + search_val, new data.CompoundDomain(self.build_domain(), [["id", "not in", blacklist]]), 'ilike', this.limit + 1, self.build_context())).then(function(data) { self.last_search = data; // possible selections for the m2o @@ -304,6 +349,7 @@ openerp.web_m2x_options = function (instance) { values.push({ label: _t("Search More..."), action: function() { + // limit = 80 for improving performance, similar // to Odoo implementation here: // https://github.com/odoo/odoo/commit/8c3cdce539d87775b59b3f2d5ceb433f995821bf @@ -311,18 +357,16 @@ openerp.web_m2x_options = function (instance) { self._search_create_popup("search", data); }); }, - classname: 'oe_m2o_dropdown_option' + classname: 'oe_m2o_dropdown_option o_m2o_dropdown_option' }); } // 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 (!no_quick_create && (m2x_create_undef || m2x_create)) { + var quick_create = self.is_option_set(self.options.create) || self.is_option_set(self.options.quick_create), + quick_create_undef = _.isUndefined(self.options.create) && _.isUndefined(self.options.quick_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']); + 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){ var raw_result = _(data.result).map(function(x) {return x[1];}); if (search_val.length > 0 && !_.include(raw_result, search_val)) { @@ -332,27 +376,25 @@ openerp.web_m2x_options = function (instance) { action: function() { self._quick_create(search_val); }, - classname: 'oe_m2o_dropdown_option' + classname: 'oe_m2o_dropdown_option o_m2o_dropdown_option' }); } } // 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 (!no_create_edit && (m2x_create_edit_undef || m2x_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), + 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']); + 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){ values.push({ label: _t("Create and Edit..."), action: function() { self._search_create_popup("form", undefined, self._create_context(search_val)); }, - classname: 'oe_m2o_dropdown_option' + classname: 'oe_m2o_dropdown_option o_m2o_dropdown_option' }); } @@ -360,29 +402,24 @@ openerp.web_m2x_options = function (instance) { }) }, - render_value: function() - { + open_badge: function(ev){ var self = this; - return jQuery.when(this._super.apply(this, arguments)) - .then(function() - { - if(self.options.open) - { - self.$el.find('.oe_tag') - .css('cursor', 'pointer') - .click(function(e) - { - var id = parseInt(jQuery(this).attr('data-id')); - self.do_action({ - type: 'ir.actions.act_window', - res_model: self.field.relation, - views: [[false, 'form']], - res_id: id, - }); + var open = (self.options && self.is_option_set(self.options.open)); + if(open){ + self.mutex.exec(function(){ + var id = parseInt($(ev.handleObj.selector).attr('data-id')); + self.do_action({ + type: 'ir.actions.act_window', + res_model: self.field.relation, + views: [[false, 'form']], + res_id: id, + target: "new" }); - } - }); + }.bind(this)); + }else{ + self.open_color_picker(ev); + } }, - }); -}; + }); +}); diff --git a/web_m2x_options/static/src/xml/base.xml b/web_m2x_options/static/src/xml/base.xml index 9fbf425eaadc..8b9421d190ac 100644 --- a/web_m2x_options/static/src/xml/base.xml +++ b/web_m2x_options/static/src/xml/base.xml @@ -6,7 +6,7 @@ - + jQuery(this).attr('t-att-data-id', 'el[0]'); From a223f07a72834a88a98aaaaa599f3e5a24e42f48 Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (ACSONE)" Date: Mon, 24 Oct 2016 16:10:19 +0200 Subject: [PATCH 08/67] Makes the module compatible with Odoo community --- web_m2x_options/static/src/js/form.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/web_m2x_options/static/src/js/form.js b/web_m2x_options/static/src/js/form.js index 8e97ad3ecb1d..f2a281725b4b 100644 --- a/web_m2x_options/static/src/js/form.js +++ b/web_m2x_options/static/src/js/form.js @@ -19,6 +19,11 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) { 'web_m2x_options.search_more', 'web_m2x_options.m2o_dialog',]; + // In odoo 9.c FielMany2One is not exposed by form_relational + // To bypass this limitation we use the widget registry to get the + // reference to the FielMany2One widget. + var FieldMany2One = core.form_widget_registry.get('many2one'); + var M2ODialog = Dialog.extend({ template: "M2ODialog", init: function(parent) { @@ -52,7 +57,7 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) { }, }); - form_relational.FieldMany2One.include({ + FieldMany2One.include({ start: function() { this._super.apply(this, arguments); @@ -188,12 +193,12 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) { values.push({ label: _t("Search More..."), action: function () { - // limit = 80 for improving performance, similar + // limit = 160 for improving performance, similar // to Odoo implementation here: - // https://github.com/odoo/odoo/commit/8c3cdce539d87775b59b3f2d5ceb433f995821bf + // https://github.com/odoo/odoo/blob/feeac2a4f1cd777770dd2b42534904ac71f23e46/addons/web/static/src/js/views/form_common.js#L213 dataset.name_search( search_val, self.build_domain(), - 'ilike', 80).done(function (data) { + 'ilike', 160).done(function (data) { self._search_create_popup("search", data); }); }, From f52a14d9954f6216961eb41976ef5eb59554f190 Mon Sep 17 00:00:00 2001 From: Zakaria Makrelouf Date: Thu, 2 Feb 2017 13:30:29 +0100 Subject: [PATCH 09/67] web_m2x_options: s/ev.handleObj.selector/currentTarget * many2many with `options={'open': True}` it always open the first element with this fix it will open the right one --- web_m2x_options/static/src/js/form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_m2x_options/static/src/js/form.js b/web_m2x_options/static/src/js/form.js index f2a281725b4b..4b8d0ad13eea 100644 --- a/web_m2x_options/static/src/js/form.js +++ b/web_m2x_options/static/src/js/form.js @@ -412,7 +412,7 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) { var open = (self.options && self.is_option_set(self.options.open)); if(open){ self.mutex.exec(function(){ - var id = parseInt($(ev.handleObj.selector).attr('data-id')); + var id = parseInt($(ev.currentTarget).data('id')); self.do_action({ type: 'ir.actions.act_window', res_model: self.field.relation, From 85294a1958be2335490aaad78d61ba87c5cefadd Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Wed, 8 Mar 2017 19:19:19 +0100 Subject: [PATCH 10/67] Fix Qweb templates. (#561) * [FIX][web_m2x_options] Fix Qweb templates. They were trying to replace non-existing elements, and this was being logged to console: Can't find "a.oe_m2o_cm_button" when extending template FieldMany2One Can't find "span.badge" when extending template FieldMany2ManyTag * Raise version correctly. * [FIX] Make many2many_tags tag deletion work again * Correct replacement of event Instead of overwriting all events from upstream widget, better just overwrite the one you need and inherit the rest. --- web_m2x_options/README.rst | 3 +- web_m2x_options/__openerp__.py | 5 +- web_m2x_options/i18n/ar.po | 66 +++++++++++++++---- web_m2x_options/i18n/de.po | 69 ++++++++++++++++---- web_m2x_options/i18n/es.po | 66 +++++++++++++++---- web_m2x_options/i18n/fi.po | 66 +++++++++++++++---- web_m2x_options/i18n/fr.po | 66 +++++++++++++++---- web_m2x_options/i18n/hr.po | 86 +++++++++++++++++++++++++ web_m2x_options/i18n/it.po | 78 +++++++++++++++------- web_m2x_options/i18n/nl_NL.po | 85 ++++++++++++++++++++++++ web_m2x_options/i18n/pt_BR.po | 68 +++++++++++++++---- web_m2x_options/i18n/sl.po | 66 +++++++++++++++---- web_m2x_options/i18n/tr.po | 67 +++++++++++++++---- web_m2x_options/static/src/js/form.js | 10 +-- web_m2x_options/static/src/xml/base.xml | 16 ++--- 15 files changed, 677 insertions(+), 140 deletions(-) create mode 100644 web_m2x_options/i18n/hr.po create mode 100644 web_m2x_options/i18n/nl_NL.po diff --git a/web_m2x_options/README.rst b/web_m2x_options/README.rst index dff75f05fe73..98cefc3c2dc6 100644 --- a/web_m2x_options/README.rst +++ b/web_m2x_options/README.rst @@ -116,7 +116,7 @@ Your XML form view definition could contain:: 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. Roadmap @@ -146,6 +146,7 @@ Contributors * Nicolas JEUDY * Yannick Vaucher * Zakaria Makrelouf +* Jairo Llopis Maintainer ---------- diff --git a/web_m2x_options/__openerp__.py b/web_m2x_options/__openerp__.py index 94c1a525bd55..7206c3ca0331 100644 --- a/web_m2x_options/__openerp__.py +++ b/web_m2x_options/__openerp__.py @@ -2,7 +2,7 @@ { "name": 'web_m2x_options', - "version": "9.0.1.0.0", + "version": "9.0.1.1.0", "depends": [ 'base', 'web', @@ -12,6 +12,7 @@ ], 'license': 'AGPL-3', 'data': ['views/view.xml'], - "author": "ACSONE SA/NV, 0k.io,Odoo Community Association (OCA)", + "author": "ACSONE SA/NV, 0k.io, Tecnativa, " + "Odoo Community Association (OCA)", 'installable': True, } diff --git a/web_m2x_options/i18n/ar.po b/web_m2x_options/i18n/ar.po index 124f84ceecdc..6253ba90233d 100644 --- a/web_m2x_options/i18n/ar.po +++ b/web_m2x_options/i18n/ar.po @@ -3,15 +3,15 @@ # * web_m2x_options # # Translators: -# SaFi J. , 2015 +# OCA Transbot , 2017 msgid "" msgstr "" -"Project-Id-Version: web (8.0)\n" +"Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-02-26 02:05+0000\n" -"PO-Revision-Date: 2015-12-16 17:30+0000\n" -"Last-Translator: SaFi J. \n" -"Language-Team: Arabic (http://www.transifex.com/oca/OCA-web-8-0/language/ar/)\n" +"POT-Creation-Date: 2018-01-03 03:50+0000\n" +"PO-Revision-Date: 2018-01-03 03:50+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Arabic (https://www.transifex.com/oca/teams/23907/ar/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" @@ -20,24 +20,66 @@ msgstr "" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:219 -#: code:addons/web_m2x_options/static/src/js/form.js:373 +#: code:addons/web_m2x_options/static/src/xml/base.xml:8 +#, python-format +msgid "!(widget.options.no_open || widget.options.no_open_edit)" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:47 +#, python-format +msgid "Cancel" +msgstr "إلغاء" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:33 +#, python-format +msgid "Create" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:232 +#: code:addons/web_m2x_options/static/src/js/form.js:382 #, python-format msgid "Create \"%s\"" msgstr "إنشاء \"%s\"" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:237 -#: code:addons/web_m2x_options/static/src/js/form.js:392 +#: code:addons/web_m2x_options/static/src/js/form.js:30 +#, python-format +msgid "Create a %s" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:250 +#: code:addons/web_m2x_options/static/src/js/form.js:401 #, python-format msgid "Create and Edit..." msgstr "إنشاء وتحرير ..." #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:188 -#: code:addons/web_m2x_options/static/src/js/form.js:349 +#: code:addons/web_m2x_options/static/src/js/form.js:43 +#, python-format +msgid "Create and edit" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:201 +#: code:addons/web_m2x_options/static/src/js/form.js:358 #, python-format msgid "Search More..." msgstr "البحث عن المزيد ..." + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:52 +#, python-format +msgid "You are creating a new %s, are you sure it does not exist yet?" +msgstr "" diff --git a/web_m2x_options/i18n/de.po b/web_m2x_options/i18n/de.po index 40eb8cacde07..da119936d9a9 100644 --- a/web_m2x_options/i18n/de.po +++ b/web_m2x_options/i18n/de.po @@ -3,15 +3,16 @@ # * web_m2x_options # # Translators: -# Rudolf Schnapka , 2016 +# OCA Transbot , 2017 +# Rudolf Schnapka , 2018 msgid "" msgstr "" -"Project-Id-Version: web (8.0)\n" +"Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-02-26 02:05+0000\n" -"PO-Revision-Date: 2016-01-18 20:15+0000\n" -"Last-Translator: Rudolf Schnapka \n" -"Language-Team: German (http://www.transifex.com/oca/OCA-web-8-0/language/de/)\n" +"POT-Creation-Date: 2018-01-03 03:50+0000\n" +"PO-Revision-Date: 2018-01-03 03:50+0000\n" +"Last-Translator: Rudolf Schnapka , 2018\n" +"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" @@ -20,24 +21,68 @@ msgstr "" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:219 -#: code:addons/web_m2x_options/static/src/js/form.js:373 +#: code:addons/web_m2x_options/static/src/xml/base.xml:8 +#, python-format +msgid "!(widget.options.no_open || widget.options.no_open_edit)" +msgstr "!(widget.options.no_open || widget.options.no_open_edit)" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:47 +#, python-format +msgid "Cancel" +msgstr "Abbrechen" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:33 +#, python-format +msgid "Create" +msgstr "Anlegen" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:232 +#: code:addons/web_m2x_options/static/src/js/form.js:382 #, python-format msgid "Create \"%s\"" msgstr "Anlegen \"%s" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:237 -#: code:addons/web_m2x_options/static/src/js/form.js:392 +#: code:addons/web_m2x_options/static/src/js/form.js:30 +#, python-format +msgid "Create a %s" +msgstr "Eine %s anlegen" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:250 +#: code:addons/web_m2x_options/static/src/js/form.js:401 #, python-format msgid "Create and Edit..." msgstr "Anlegen und Bearbeiten" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:188 -#: code:addons/web_m2x_options/static/src/js/form.js:349 +#: code:addons/web_m2x_options/static/src/js/form.js:43 +#, python-format +msgid "Create and edit" +msgstr "Anlegen und bearbeiten" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:201 +#: code:addons/web_m2x_options/static/src/js/form.js:358 #, python-format msgid "Search More..." msgstr "Suche weitere..." + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:52 +#, python-format +msgid "You are creating a new %s, are you sure it does not exist yet?" +msgstr "" +"Sie legen eine neue %s an, sind Sie sicher, dass diese nicht bereits " +"vorhanden ist?" diff --git a/web_m2x_options/i18n/es.po b/web_m2x_options/i18n/es.po index bd3b1e51bc9d..0c2c9feb215b 100644 --- a/web_m2x_options/i18n/es.po +++ b/web_m2x_options/i18n/es.po @@ -3,15 +3,15 @@ # * web_m2x_options # # Translators: -# Pedro M. Baeza , 2015 +# OCA Transbot , 2017 msgid "" msgstr "" -"Project-Id-Version: web (8.0)\n" +"Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-02-26 02:05+0000\n" -"PO-Revision-Date: 2015-11-07 11:28+0000\n" -"Last-Translator: Pedro M. Baeza \n" -"Language-Team: Spanish (http://www.transifex.com/oca/OCA-web-8-0/language/es/)\n" +"POT-Creation-Date: 2018-01-03 03:50+0000\n" +"PO-Revision-Date: 2018-01-03 03:50+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" @@ -20,24 +20,66 @@ msgstr "" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:219 -#: code:addons/web_m2x_options/static/src/js/form.js:373 +#: code:addons/web_m2x_options/static/src/xml/base.xml:8 +#, python-format +msgid "!(widget.options.no_open || widget.options.no_open_edit)" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:47 +#, python-format +msgid "Cancel" +msgstr "Cancelar" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:33 +#, python-format +msgid "Create" +msgstr "Crear" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:232 +#: code:addons/web_m2x_options/static/src/js/form.js:382 #, python-format msgid "Create \"%s\"" msgstr "Crear \"%s\"" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:237 -#: code:addons/web_m2x_options/static/src/js/form.js:392 +#: code:addons/web_m2x_options/static/src/js/form.js:30 +#, python-format +msgid "Create a %s" +msgstr "Crear un %s" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:250 +#: code:addons/web_m2x_options/static/src/js/form.js:401 #, python-format msgid "Create and Edit..." msgstr "Crear y editar..." #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:188 -#: code:addons/web_m2x_options/static/src/js/form.js:349 +#: code:addons/web_m2x_options/static/src/js/form.js:43 +#, python-format +msgid "Create and edit" +msgstr "Crear y editar" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:201 +#: code:addons/web_m2x_options/static/src/js/form.js:358 #, python-format msgid "Search More..." msgstr "Buscar más..." + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:52 +#, python-format +msgid "You are creating a new %s, are you sure it does not exist yet?" +msgstr "Está creando un nuevo %s, ¿está seguro de no existe ya?" diff --git a/web_m2x_options/i18n/fi.po b/web_m2x_options/i18n/fi.po index b374d7eb9458..0d5a5c6cc520 100644 --- a/web_m2x_options/i18n/fi.po +++ b/web_m2x_options/i18n/fi.po @@ -3,15 +3,15 @@ # * web_m2x_options # # Translators: -# Jarmo Kortetjärvi , 2016 +# OCA Transbot , 2017 msgid "" msgstr "" -"Project-Id-Version: web (8.0)\n" +"Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-02-26 02:05+0000\n" -"PO-Revision-Date: 2016-02-01 09:52+0000\n" -"Last-Translator: Jarmo Kortetjärvi \n" -"Language-Team: Finnish (http://www.transifex.com/oca/OCA-web-8-0/language/fi/)\n" +"POT-Creation-Date: 2018-01-03 03:50+0000\n" +"PO-Revision-Date: 2018-01-03 03:50+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Finnish (https://www.transifex.com/oca/teams/23907/fi/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" @@ -20,24 +20,66 @@ msgstr "" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:219 -#: code:addons/web_m2x_options/static/src/js/form.js:373 +#: code:addons/web_m2x_options/static/src/xml/base.xml:8 +#, python-format +msgid "!(widget.options.no_open || widget.options.no_open_edit)" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:47 +#, python-format +msgid "Cancel" +msgstr "Peru" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:33 +#, python-format +msgid "Create" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:232 +#: code:addons/web_m2x_options/static/src/js/form.js:382 #, python-format msgid "Create \"%s\"" msgstr "Luo \"%s\"" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:237 -#: code:addons/web_m2x_options/static/src/js/form.js:392 +#: code:addons/web_m2x_options/static/src/js/form.js:30 +#, python-format +msgid "Create a %s" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:250 +#: code:addons/web_m2x_options/static/src/js/form.js:401 #, python-format msgid "Create and Edit..." msgstr "Luo ja muokkaa..." #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:188 -#: code:addons/web_m2x_options/static/src/js/form.js:349 +#: code:addons/web_m2x_options/static/src/js/form.js:43 +#, python-format +msgid "Create and edit" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:201 +#: code:addons/web_m2x_options/static/src/js/form.js:358 #, python-format msgid "Search More..." msgstr "Hae lisää..." + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:52 +#, python-format +msgid "You are creating a new %s, are you sure it does not exist yet?" +msgstr "" diff --git a/web_m2x_options/i18n/fr.po b/web_m2x_options/i18n/fr.po index 3be5ae233eab..31647daf9534 100644 --- a/web_m2x_options/i18n/fr.po +++ b/web_m2x_options/i18n/fr.po @@ -3,15 +3,15 @@ # * web_m2x_options # # Translators: -# Christophe CHAUVET , 2016 +# OCA Transbot , 2017 msgid "" msgstr "" -"Project-Id-Version: web (8.0)\n" +"Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-05-06 15:50+0000\n" -"PO-Revision-Date: 2016-05-06 08:27+0000\n" -"Last-Translator: Christophe CHAUVET \n" -"Language-Team: French (http://www.transifex.com/oca/OCA-web-8-0/language/fr/)\n" +"POT-Creation-Date: 2018-01-03 03:50+0000\n" +"PO-Revision-Date: 2018-01-03 03:50+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" @@ -20,24 +20,66 @@ msgstr "" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:219 -#: code:addons/web_m2x_options/static/src/js/form.js:373 +#: code:addons/web_m2x_options/static/src/xml/base.xml:8 +#, python-format +msgid "!(widget.options.no_open || widget.options.no_open_edit)" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:47 +#, python-format +msgid "Cancel" +msgstr "Annuler" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:33 +#, python-format +msgid "Create" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:232 +#: code:addons/web_m2x_options/static/src/js/form.js:382 #, python-format msgid "Create \"%s\"" msgstr "Creer \"%s\"" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:237 -#: code:addons/web_m2x_options/static/src/js/form.js:392 +#: code:addons/web_m2x_options/static/src/js/form.js:30 +#, python-format +msgid "Create a %s" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:250 +#: code:addons/web_m2x_options/static/src/js/form.js:401 #, python-format msgid "Create and Edit..." msgstr "Créer et modifier..." #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:188 -#: code:addons/web_m2x_options/static/src/js/form.js:349 +#: code:addons/web_m2x_options/static/src/js/form.js:43 +#, python-format +msgid "Create and edit" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:201 +#: code:addons/web_m2x_options/static/src/js/form.js:358 #, python-format msgid "Search More..." msgstr "Rechercher plus..." + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:52 +#, python-format +msgid "You are creating a new %s, are you sure it does not exist yet?" +msgstr "" diff --git a/web_m2x_options/i18n/hr.po b/web_m2x_options/i18n/hr.po new file mode 100644 index 000000000000..644c0b4ba912 --- /dev/null +++ b/web_m2x_options/i18n/hr.po @@ -0,0 +1,86 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +# Translators: +# Bole , 2017 +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-03 03:50+0000\n" +"PO-Revision-Date: 2018-01-03 03:50+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: hr\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/xml/base.xml:8 +#, python-format +msgid "!(widget.options.no_open || widget.options.no_open_edit)" +msgstr "!(opcije isključuju otvaranje ili uređivanje)" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:47 +#, python-format +msgid "Cancel" +msgstr "Otkaži" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:33 +#, python-format +msgid "Create" +msgstr "Kreiraj" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:232 +#: code:addons/web_m2x_options/static/src/js/form.js:382 +#, python-format +msgid "Create \"%s\"" +msgstr "Kreiraj \" %s\"" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:30 +#, python-format +msgid "Create a %s" +msgstr "Kreiraj %s" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:250 +#: code:addons/web_m2x_options/static/src/js/form.js:401 +#, python-format +msgid "Create and Edit..." +msgstr "Kreiraj i uredi..." + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:43 +#, python-format +msgid "Create and edit" +msgstr "Kreiraj i uredi" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:201 +#: code:addons/web_m2x_options/static/src/js/form.js:358 +#, python-format +msgid "Search More..." +msgstr "Traži dalje..." + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:52 +#, python-format +msgid "You are creating a new %s, are you sure it does not exist yet?" +msgstr "Želite kreirati novi %s, jeste li sigurni da već ne postoji?" diff --git a/web_m2x_options/i18n/it.po b/web_m2x_options/i18n/it.po index c8db1568fdf7..47e767833181 100644 --- a/web_m2x_options/i18n/it.po +++ b/web_m2x_options/i18n/it.po @@ -3,27 +3,15 @@ # * web_m2x_options # # Translators: -# Ahmet Altınışık , 2015 -# Antonio Trueba, 2016 -# Armando Vulcano Junior , 2015 -# Carles Antoli , 2015 -# Bole , 2015 -# FIRST AUTHOR , 2012,2014 -# Giacomo , 2015 -# Hotellook, 2014 -# Jarmo Kortetjärvi , 2016 -# Paolo Valier, 2016 -# Paolo Valier, 2016 -# Rudolf Schnapka , 2016 -# Thomas A. Jaeger, 2015 +# OCA Transbot , 2017 msgid "" msgstr "" -"Project-Id-Version: web (8.0)\n" +"Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-04-28 07:09+0000\n" -"PO-Revision-Date: 2016-04-28 06:46+0000\n" -"Last-Translator: Paolo Valier\n" -"Language-Team: Italian (http://www.transifex.com/oca/OCA-web-8-0/language/it/)\n" +"POT-Creation-Date: 2018-01-03 03:50+0000\n" +"PO-Revision-Date: 2018-01-03 03:50+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" @@ -32,24 +20,66 @@ msgstr "" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:219 -#: code:addons/web_m2x_options/static/src/js/form.js:373 +#: code:addons/web_m2x_options/static/src/xml/base.xml:8 +#, python-format +msgid "!(widget.options.no_open || widget.options.no_open_edit)" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:47 +#, python-format +msgid "Cancel" +msgstr "Annulla" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:33 +#, python-format +msgid "Create" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:232 +#: code:addons/web_m2x_options/static/src/js/form.js:382 #, python-format msgid "Create \"%s\"" msgstr "Crea \"%s\"" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:237 -#: code:addons/web_m2x_options/static/src/js/form.js:392 +#: code:addons/web_m2x_options/static/src/js/form.js:30 +#, python-format +msgid "Create a %s" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:250 +#: code:addons/web_m2x_options/static/src/js/form.js:401 #, python-format msgid "Create and Edit..." msgstr "Crea e Modifica..." #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:188 -#: code:addons/web_m2x_options/static/src/js/form.js:349 +#: code:addons/web_m2x_options/static/src/js/form.js:43 +#, python-format +msgid "Create and edit" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:201 +#: code:addons/web_m2x_options/static/src/js/form.js:358 #, python-format msgid "Search More..." msgstr "Cerca altro..." + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:52 +#, python-format +msgid "You are creating a new %s, are you sure it does not exist yet?" +msgstr "" diff --git a/web_m2x_options/i18n/nl_NL.po b/web_m2x_options/i18n/nl_NL.po new file mode 100644 index 000000000000..1f7da2402d17 --- /dev/null +++ b/web_m2x_options/i18n/nl_NL.po @@ -0,0 +1,85 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_m2x_options +# +# Translators: +# Peter Hageman , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-01 03:35+0000\n" +"PO-Revision-Date: 2017-07-01 03:35+0000\n" +"Last-Translator: Peter Hageman , 2017\n" +"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/teams/23907/nl_NL/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: nl_NL\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/xml/base.xml:8 +#, python-format +msgid "!(widget.options.no_open || widget.options.no_open_edit)" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:47 +#, python-format +msgid "Cancel" +msgstr "Annuleer" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:33 +#, python-format +msgid "Create" +msgstr "Aanmaken" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:224 +#: code:addons/web_m2x_options/static/src/js/form.js:374 +#, python-format +msgid "Create \"%s\"" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:30 +#, python-format +msgid "Create a %s" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:242 +#: code:addons/web_m2x_options/static/src/js/form.js:393 +#, python-format +msgid "Create and Edit..." +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:43 +#, python-format +msgid "Create and edit" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:193 +#: code:addons/web_m2x_options/static/src/js/form.js:350 +#, python-format +msgid "Search More..." +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:52 +#, python-format +msgid "You are creating a new %s, are you sure it does not exist yet?" +msgstr "" diff --git a/web_m2x_options/i18n/pt_BR.po b/web_m2x_options/i18n/pt_BR.po index cf28995e3eed..538bfc7e7930 100644 --- a/web_m2x_options/i18n/pt_BR.po +++ b/web_m2x_options/i18n/pt_BR.po @@ -3,15 +3,16 @@ # * web_m2x_options # # Translators: -# danimaribeiro , 2016 +# OCA Transbot , 2017 +# Rodrigo de Almeida Sottomaior Macedo , 2017 msgid "" msgstr "" -"Project-Id-Version: web (8.0)\n" +"Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-03-11 02:17+0000\n" -"PO-Revision-Date: 2016-03-05 16:20+0000\n" -"Last-Translator: danimaribeiro \n" -"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-web-8-0/language/pt_BR/)\n" +"POT-Creation-Date: 2018-01-03 03:50+0000\n" +"PO-Revision-Date: 2018-01-03 03:50+0000\n" +"Last-Translator: Rodrigo de Almeida Sottomaior Macedo , 2017\n" +"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/23907/pt_BR/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" @@ -20,24 +21,67 @@ msgstr "" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:219 -#: code:addons/web_m2x_options/static/src/js/form.js:373 +#: code:addons/web_m2x_options/static/src/xml/base.xml:8 +#, python-format +msgid "!(widget.options.no_open || widget.options.no_open_edit)" +msgstr "!(widget.options.no_open || widget.options.no_open_edit)" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:47 +#, python-format +msgid "Cancel" +msgstr "Cancelar" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:33 +#, python-format +msgid "Create" +msgstr "Criar" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:232 +#: code:addons/web_m2x_options/static/src/js/form.js:382 #, python-format msgid "Create \"%s\"" msgstr "Criar \"%s\"" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:237 -#: code:addons/web_m2x_options/static/src/js/form.js:392 +#: code:addons/web_m2x_options/static/src/js/form.js:30 +#, python-format +msgid "Create a %s" +msgstr "Criar um %s" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:250 +#: code:addons/web_m2x_options/static/src/js/form.js:401 #, python-format msgid "Create and Edit..." msgstr "Criar e editar.." #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:188 -#: code:addons/web_m2x_options/static/src/js/form.js:349 +#: code:addons/web_m2x_options/static/src/js/form.js:43 +#, python-format +msgid "Create and edit" +msgstr "Criar e editar" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:201 +#: code:addons/web_m2x_options/static/src/js/form.js:358 #, python-format msgid "Search More..." msgstr "Buscar mais..." + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:52 +#, python-format +msgid "You are creating a new %s, are you sure it does not exist yet?" +msgstr "" +"Você está criando um novo %s, você tem certeza de que ainda não existe?" diff --git a/web_m2x_options/i18n/sl.po b/web_m2x_options/i18n/sl.po index 7192762e128e..a4e3ae1f3184 100644 --- a/web_m2x_options/i18n/sl.po +++ b/web_m2x_options/i18n/sl.po @@ -3,15 +3,15 @@ # * web_m2x_options # # Translators: -# Matjaž Mozetič , 2015 +# OCA Transbot , 2017 msgid "" msgstr "" -"Project-Id-Version: web (8.0)\n" +"Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-02-26 02:05+0000\n" -"PO-Revision-Date: 2015-11-08 05:46+0000\n" -"Last-Translator: Matjaž Mozetič \n" -"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-web-8-0/language/sl/)\n" +"POT-Creation-Date: 2018-01-03 03:50+0000\n" +"PO-Revision-Date: 2018-01-03 03:50+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" @@ -20,24 +20,66 @@ msgstr "" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:219 -#: code:addons/web_m2x_options/static/src/js/form.js:373 +#: code:addons/web_m2x_options/static/src/xml/base.xml:8 +#, python-format +msgid "!(widget.options.no_open || widget.options.no_open_edit)" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:47 +#, python-format +msgid "Cancel" +msgstr "Preklic" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:33 +#, python-format +msgid "Create" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:232 +#: code:addons/web_m2x_options/static/src/js/form.js:382 #, python-format msgid "Create \"%s\"" msgstr "Ustvari \"%s\"" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:237 -#: code:addons/web_m2x_options/static/src/js/form.js:392 +#: code:addons/web_m2x_options/static/src/js/form.js:30 +#, python-format +msgid "Create a %s" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:250 +#: code:addons/web_m2x_options/static/src/js/form.js:401 #, python-format msgid "Create and Edit..." msgstr "Ustvari in urejaj..." #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:188 -#: code:addons/web_m2x_options/static/src/js/form.js:349 +#: code:addons/web_m2x_options/static/src/js/form.js:43 +#, python-format +msgid "Create and edit" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:201 +#: code:addons/web_m2x_options/static/src/js/form.js:358 #, python-format msgid "Search More..." msgstr "Poišči več..." + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:52 +#, python-format +msgid "You are creating a new %s, are you sure it does not exist yet?" +msgstr "" diff --git a/web_m2x_options/i18n/tr.po b/web_m2x_options/i18n/tr.po index 2b9f46fdd2ee..584219f2c764 100644 --- a/web_m2x_options/i18n/tr.po +++ b/web_m2x_options/i18n/tr.po @@ -3,16 +3,15 @@ # * web_m2x_options # # Translators: -# Ahmet Altınışık , 2015 -# Ahmet Altınışık , 2015 +# OCA Transbot , 2017 msgid "" msgstr "" -"Project-Id-Version: web (8.0)\n" +"Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-02-26 02:05+0000\n" -"PO-Revision-Date: 2015-12-30 21:53+0000\n" -"Last-Translator: Ahmet Altınışık \n" -"Language-Team: Turkish (http://www.transifex.com/oca/OCA-web-8-0/language/tr/)\n" +"POT-Creation-Date: 2018-01-03 03:50+0000\n" +"PO-Revision-Date: 2018-01-03 03:50+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Turkish (https://www.transifex.com/oca/teams/23907/tr/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" @@ -21,24 +20,66 @@ msgstr "" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:219 -#: code:addons/web_m2x_options/static/src/js/form.js:373 +#: code:addons/web_m2x_options/static/src/xml/base.xml:8 +#, python-format +msgid "!(widget.options.no_open || widget.options.no_open_edit)" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:47 +#, python-format +msgid "Cancel" +msgstr "İptal" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:33 +#, python-format +msgid "Create" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:232 +#: code:addons/web_m2x_options/static/src/js/form.js:382 #, python-format msgid "Create \"%s\"" msgstr "Oluştur \"%s\"" #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:237 -#: code:addons/web_m2x_options/static/src/js/form.js:392 +#: code:addons/web_m2x_options/static/src/js/form.js:30 +#, python-format +msgid "Create a %s" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:250 +#: code:addons/web_m2x_options/static/src/js/form.js:401 #, python-format msgid "Create and Edit..." msgstr "Oluştur ve düzenle..." #. module: web_m2x_options #. openerp-web -#: code:addons/web_m2x_options/static/src/js/form.js:188 -#: code:addons/web_m2x_options/static/src/js/form.js:349 +#: code:addons/web_m2x_options/static/src/js/form.js:43 +#, python-format +msgid "Create and edit" +msgstr "" + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:201 +#: code:addons/web_m2x_options/static/src/js/form.js:358 #, python-format msgid "Search More..." msgstr "Daha Fazla..." + +#. module: web_m2x_options +#. openerp-web +#: code:addons/web_m2x_options/static/src/js/form.js:52 +#, python-format +msgid "You are creating a new %s, are you sure it does not exist yet?" +msgstr "" diff --git a/web_m2x_options/static/src/js/form.js b/web_m2x_options/static/src/js/form.js index 4b8d0ad13eea..4fb83da338e9 100644 --- a/web_m2x_options/static/src/js/form.js +++ b/web_m2x_options/static/src/js/form.js @@ -260,13 +260,9 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) { }); form_relational.FieldMany2ManyTags.include({ - events: { - 'click .o_delete': function(e) { - this.remove_id($(e.target).parent().data('id')); - }, - 'click .badge': 'open_badge', - 'mousedown .o_colorpicker span': 'update_color', - 'focusout .o_colorpicker': 'close_color_picker', + init: function () { + this.events["click .badge"] = "open_badge"; + return this._super.apply(this, arguments); }, show_error_displayer: function () { if ((typeof this.options.m2o_dialog === 'undefined' && this.can_create) || diff --git a/web_m2x_options/static/src/xml/base.xml b/web_m2x_options/static/src/xml/base.xml index 8b9421d190ac..094e942eada0 100644 --- a/web_m2x_options/static/src/xml/base.xml +++ b/web_m2x_options/static/src/xml/base.xml @@ -1,13 +1,11 @@ + + - - - jQuery(this).attr('t-if', '!(widget.options.no_open || widget.options.no_open_edit)'); + + + !(widget.options.no_open || widget.options.no_open_edit) + - - - - jQuery(this).attr('t-att-data-id', 'el[0]'); - - From 10dca0eadb96bee11d5558494ffbbd38a4c4be15 Mon Sep 17 00:00:00 2001 From: David Vidal Date: Tue, 16 May 2017 12:55:02 +0200 Subject: [PATCH 11/67] [MIG] web_m2x_options: migrated to 10.0 --- web_m2x_options/README.rst | 4 ++++ .../{__openerp__.py => __manifest__.py} | 2 +- web_m2x_options/static/src/js/form.js | 2 -- web_m2x_options/static/src/xml/base.xml | 6 ++++-- web_m2x_options/views/view.xml | 17 +++++++++-------- 5 files changed, 18 insertions(+), 13 deletions(-) rename web_m2x_options/{__openerp__.py => __manifest__.py} (92%) diff --git a/web_m2x_options/README.rst b/web_m2x_options/README.rst index 98cefc3c2dc6..f0e78aa44650 100644 --- a/web_m2x_options/README.rst +++ b/web_m2x_options/README.rst @@ -6,6 +6,9 @@ Add new options for many2one field ================================== +Description +----------- + This modules modifies "many2one" and "many2manytags" form widgets so as to add some new display control options. @@ -147,6 +150,7 @@ Contributors * Yannick Vaucher * Zakaria Makrelouf * Jairo Llopis +* David Vidal Maintainer ---------- diff --git a/web_m2x_options/__openerp__.py b/web_m2x_options/__manifest__.py similarity index 92% rename from web_m2x_options/__openerp__.py rename to web_m2x_options/__manifest__.py index 7206c3ca0331..ac436e6a6911 100644 --- a/web_m2x_options/__openerp__.py +++ b/web_m2x_options/__manifest__.py @@ -2,7 +2,7 @@ { "name": 'web_m2x_options', - "version": "9.0.1.1.0", + "version": "10.0.1.0.0", "depends": [ 'base', 'web', diff --git a/web_m2x_options/static/src/js/form.js b/web_m2x_options/static/src/js/form.js index 4fb83da338e9..13ec3a6e5d43 100644 --- a/web_m2x_options/static/src/js/form.js +++ b/web_m2x_options/static/src/js/form.js @@ -4,13 +4,11 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) { "use strict"; - var $ = require("$"); var core = require('web.core'), data = require('web.data'), Dialog = require('web.Dialog'), Model = require('web.Model'), form_relational = require('web.form_relational'), - _ = require('_'), _t = core._t; var OPTIONS = ['web_m2x_options.create', diff --git a/web_m2x_options/static/src/xml/base.xml b/web_m2x_options/static/src/xml/base.xml index 094e942eada0..c095218bfe29 100644 --- a/web_m2x_options/static/src/xml/base.xml +++ b/web_m2x_options/static/src/xml/base.xml @@ -4,8 +4,10 @@ - - !(widget.options.no_open || widget.options.no_open_edit) + + + !(widget.options.no_open || widget.options.no_open_edit) + diff --git a/web_m2x_options/views/view.xml b/web_m2x_options/views/view.xml index 9628625b5103..85d435c1e140 100644 --- a/web_m2x_options/views/view.xml +++ b/web_m2x_options/views/view.xml @@ -1,12 +1,13 @@ - - - -