diff --git a/web_advanced_search_wildcard/README.rst b/web_advanced_search_wildcard/README.rst deleted file mode 100644 index 8c6de995..00000000 --- a/web_advanced_search_wildcard/README.rst +++ /dev/null @@ -1,61 +0,0 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :alt: License: AGPL-3 - -============================ -Wildcard in advanced search -============================ - -Allows =ilike ('matches') operator to advanced search option. - - -Usage -===== -Use % as a placeholder. - -Example: "Zip" - 'matches' - "1%" gives all zip starting with 1 - -.. image:: /web_advanced_search_wildcard/static/description/screenshot.png - :alt: Screenshot - - -Also allows insensitive exact search. -Example "Name" - 'matches' - "john" will find "John" and "john" but not "Johnson". - -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 -======= - -Images ------- - -* Odoo Community Association: `Icon `_. - -Contributors ------------- - -* Markus Schneider -* Thomas Rehn -* L Freeke - - -Maintainer ----------- - -.. image:: https://odoo-community.org/logo.png - :alt: Odoo Community Association - :target: https://odoo-community.org - -This module is maintained by the OCA. - -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 https://odoo-community.org. diff --git a/web_advanced_search_wildcard/__init__.py b/web_advanced_search_wildcard/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/web_advanced_search_wildcard/__openerp__.py b/web_advanced_search_wildcard/__openerp__.py deleted file mode 100644 index 797f3a60..00000000 --- a/web_advanced_search_wildcard/__openerp__.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# © 2014 initOS GmbH & Co. KG (). -# © 2016 Therp BV . -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -{ - "name": "Wildcard in advanced search", - "summary": "Webmodule to add wildcard operators in advanced search field", - "version": "8.0.1.0.0", - "category": "web", - "license": 'AGPL-3', - "author": "initOS GmbH & Co. KG,Odoo Community Association (OCA),Therp BV", - "application": False, - "installable": True, - "depends": [ - "web" - ], - 'data': [ - "views/template.xml", - ], -} diff --git a/web_advanced_search_wildcard/i18n/de.po b/web_advanced_search_wildcard/i18n/de.po deleted file mode 100644 index 4cfbc4f3..00000000 --- a/web_advanced_search_wildcard/i18n/de.po +++ /dev/null @@ -1,27 +0,0 @@ -# Translation of OpenERP Server. -# This file contains the translation of the following modules: -# -# Rudolf Schnapka , 2015. -msgid "" -msgstr "" -"Project-Id-Version: OpenERP Server 7.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-09-15 09:11+0000\n" -"PO-Revision-Date: 2015-01-04 14:07+0100\n" -"Last-Translator: Rudolf Schnapka \n" -"Language-Team: German \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: \n" -"Language: de\n" -"X-Generator: Lokalize 1.5\n" - -#. module: web_advanced_search_wildcard -#. openerp-web -#: code:addons/web_advanced_search_wildcard/static/src/js/search.js:4 -#, python-format -msgid "matches" -msgstr "gleicht" - - diff --git a/web_advanced_search_wildcard/i18n/es.po b/web_advanced_search_wildcard/i18n/es.po deleted file mode 100644 index 2f9437ce..00000000 --- a/web_advanced_search_wildcard/i18n/es.po +++ /dev/null @@ -1,26 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * web_advanced_search_wildcard -# -# Translators: -# Pedro M. Baeza , 2016 -msgid "" -msgstr "" -"Project-Id-Version: web (8.0)\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-11-26 01:59+0000\n" -"PO-Revision-Date: 2016-10-13 18:37+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_advanced_search_wildcard -#. openerp-web -#: code:addons/web_advanced_search_wildcard/static/src/js/search.js:4 -#, python-format -msgid "matches" -msgstr "coincide con" diff --git a/web_advanced_search_wildcard/i18n/fi.po b/web_advanced_search_wildcard/i18n/fi.po deleted file mode 100644 index 91f0ab2e..00000000 --- a/web_advanced_search_wildcard/i18n/fi.po +++ /dev/null @@ -1,26 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * web_advanced_search_wildcard -# -# Translators: -# Jarmo Kortetjärvi , 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-07 08:28+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_advanced_search_wildcard -#. openerp-web -#: code:addons/web_advanced_search_wildcard/static/src/js/search.js:4 -#, python-format -msgid "matches" -msgstr "osumat" diff --git a/web_advanced_search_wildcard/i18n/fr.po b/web_advanced_search_wildcard/i18n/fr.po deleted file mode 100644 index 302b2e39..00000000 --- a/web_advanced_search_wildcard/i18n/fr.po +++ /dev/null @@ -1,26 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * web_advanced_search_wildcard -# -# 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:19+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_advanced_search_wildcard -#. openerp-web -#: code:addons/web_advanced_search_wildcard/static/src/js/search.js:4 -#, python-format -msgid "matches" -msgstr "correspondances" diff --git a/web_advanced_search_wildcard/i18n/pt_BR.po b/web_advanced_search_wildcard/i18n/pt_BR.po deleted file mode 100644 index 0464430f..00000000 --- a/web_advanced_search_wildcard/i18n/pt_BR.po +++ /dev/null @@ -1,26 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * web_advanced_search_wildcard -# -# 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:05+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_advanced_search_wildcard -#. openerp-web -#: code:addons/web_advanced_search_wildcard/static/src/js/search.js:4 -#, python-format -msgid "matches" -msgstr "resultados" diff --git a/web_advanced_search_wildcard/i18n/sl.po b/web_advanced_search_wildcard/i18n/sl.po deleted file mode 100644 index f8aa6f65..00000000 --- a/web_advanced_search_wildcard/i18n/sl.po +++ /dev/null @@ -1,26 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * web_advanced_search_wildcard -# -# Translators: -# Matjaž Mozetič , 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-27 16:56+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_advanced_search_wildcard -#. openerp-web -#: code:addons/web_advanced_search_wildcard/static/src/js/search.js:4 -#, python-format -msgid "matches" -msgstr "ujemanj" diff --git a/web_advanced_search_wildcard/i18n/web_advanced_search_wildcard.pot b/web_advanced_search_wildcard/i18n/web_advanced_search_wildcard.pot deleted file mode 100644 index e187a2da..00000000 --- a/web_advanced_search_wildcard/i18n/web_advanced_search_wildcard.pot +++ /dev/null @@ -1,23 +0,0 @@ -# Translation of OpenERP Server. -# This file contains the translation of the following modules: -# -msgid "" -msgstr "" -"Project-Id-Version: OpenERP Server 7.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-09-15 09:11+0000\n" -"PO-Revision-Date: 2014-09-15 11:12+0100\n" -"Last-Translator: M\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: \n" - -#. module: web_advanced_search_wildcard -#. openerp-web -#: code:addons/web_advanced_search_wildcard/static/src/js/search.js:4 -#, python-format -msgid "matches" -msgstr "" - diff --git a/web_advanced_search_wildcard/static/description/screenshot.png b/web_advanced_search_wildcard/static/description/screenshot.png deleted file mode 100644 index 57848f90..00000000 Binary files a/web_advanced_search_wildcard/static/description/screenshot.png and /dev/null differ diff --git a/web_advanced_search_wildcard/static/src/js/search.js b/web_advanced_search_wildcard/static/src/js/search.js deleted file mode 100644 index 1b43dc0c..00000000 --- a/web_advanced_search_wildcard/static/src/js/search.js +++ /dev/null @@ -1,6 +0,0 @@ -openerp.web_advanced_search_wildcard = function(instance){ - var _lt = instance.web._lt; - instance.web.search.ExtendedSearchProposition.Char.prototype.operators.push( - {value: '=ilike', text: _lt("matches")} - ); -}; diff --git a/web_advanced_search_wildcard/views/template.xml b/web_advanced_search_wildcard/views/template.xml deleted file mode 100644 index bfe353d5..00000000 --- a/web_advanced_search_wildcard/views/template.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - diff --git a/web_dashboard_tile/models/tile_tile.py b/web_dashboard_tile/models/tile_tile.py index bc304b69..38ce5c66 100644 --- a/web_dashboard_tile/models/tile_tile.py +++ b/web_dashboard_tile/models/tile_tile.py @@ -142,71 +142,74 @@ class TileTile(models.Model): string='Error Details', compute='_compute_data') - @api.one + @api.multi def _compute_data(self): - if not self.active: - return - model = self.env[self.model_id.model] - eval_context = self._get_eval_context() - domain = self.domain or '[]' - try: - count = model.search_count(eval(domain, eval_context)) - except Exception as e: - self.primary_value = self.secondary_value = 'ERR!' - self.error = str(e) - return - if any([ - self.primary_function and - self.primary_function != 'count', - self.secondary_function and - self.secondary_function != 'count' - ]): - records = model.search(eval(domain, eval_context)) - for f in ['primary_', 'secondary_']: - f_function = f + 'function' - f_field_id = f + 'field_id' - f_format = f + 'format' - f_value = f + 'value' - value = 0 - if self[f_function] == 'count': - value = count - elif self[f_function]: - func = FIELD_FUNCTIONS[self[f_function]]['func'] - if func and self[f_field_id] and count: - vals = [x[self[f_field_id].name] for x in records] - value = func(vals) - if self[f_function]: - try: - self[f_value] = (self[f_format] or '{:,}').format(value) - except ValueError as e: - self[f_value] = 'F_ERR!' - self.error = str(e) - return - else: - self[f_value] = False + for rec in self: + if not rec.active: + return + model = self.env[rec.model_id.model] + eval_context = self._get_eval_context() + domain = rec.domain or '[]' + try: + count = model.search_count(eval(domain, eval_context)) + except Exception as e: + rec.primary_value = rec.secondary_value = 'ERR!' + rec.error = str(e) + return + if any([ + rec.primary_function and + rec.primary_function != 'count', + rec.secondary_function and + rec.secondary_function != 'count' + ]): + records = model.search(eval(domain, eval_context)) + for f in ['primary_', 'secondary_']: + f_function = f + 'function' + f_field_id = f + 'field_id' + f_format = f + 'format' + f_value = f + 'value' + value = 0 + if rec[f_function] == 'count': + value = count + elif rec[f_function]: + func = FIELD_FUNCTIONS[rec[f_function]]['func'] + if func and rec[f_field_id] and count: + vals = [x[rec[f_field_id].name] for x in records] + value = func(vals) + if rec[f_function]: + try: + rec[f_value] = (rec[f_format] or '{:,}').format(value) + except ValueError as e: + rec[f_value] = 'F_ERR!' + rec.error = str(e) + return + else: + rec[f_value] = False - @api.one + @api.multi @api.onchange('primary_function', 'primary_field_id', 'secondary_function', 'secondary_field_id') def _compute_helper(self): - for f in ['primary_', 'secondary_']: - f_function = f + 'function' - f_field_id = f + 'field_id' - f_helper = f + 'helper' - self[f_helper] = '' - field_func = FIELD_FUNCTIONS.get(self[f_function], {}) - help = field_func.get('help', False) - if help: - if self[f_function] != 'count' and self[f_field_id]: - desc = self[f_field_id].field_description - self[f_helper] = help % desc - else: - self[f_helper] = help + for rec in self: + for f in ['primary_', 'secondary_']: + f_function = f + 'function' + f_field_id = f + 'field_id' + f_helper = f + 'helper' + rec[f_helper] = '' + field_func = FIELD_FUNCTIONS.get(rec[f_function], {}) + help = field_func.get('help', False) + if help: + if rec[f_function] != 'count' and rec[f_field_id]: + desc = rec[f_field_id].field_description + rec[f_helper] = help % desc + else: + rec[f_helper] = help - @api.one + @api.multi def _compute_active(self): ima = self.env['ir.model.access'] - self.active = ima.check(self.model_id.model, 'read', False) + for rec in self: + rec.active = ima.check(rec.model_id.model, 'read', False) def _search_active(self, operator, value): cr = self.env.cr @@ -226,17 +229,18 @@ class TileTile(models.Model): return [('id', 'in', ids)] # Constraints and onchanges - @api.one + @api.multi @api.constrains('model_id', 'primary_field_id', 'secondary_field_id') def _check_model_id_field_id(self): - if any([ - self.primary_field_id and - self.primary_field_id.model_id.id != self.model_id.id, - self.secondary_field_id and - self.secondary_field_id.model_id.id != self.model_id.id - ]): - raise ValidationError( - _("Please select a field from the selected model.")) + for rec in self: + if any([ + rec.primary_field_id and + rec.primary_field_id.model_id.id != rec.model_id.id, + rec.secondary_field_id and + rec.secondary_field_id.model_id.id != rec.model_id.id + ]): + raise ValidationError( + _("Please select a field from the selected model.")) @api.onchange('model_id') def _onchange_model_id(self):