diff --git a/base_ir_filters_active/README.rst b/base_ir_filters_active/README.rst new file mode 100644 index 000000000..33053f59c --- /dev/null +++ b/base_ir_filters_active/README.rst @@ -0,0 +1,56 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License: AGPL-3 + +=============== +Disable filters +=============== + +This module was written to allow to disable search filters. This is mainly +useful when you deliver a lot of automated actions with filters to a client +and you don't want to pollute the search views of the objects in question. + +Usage +===== + +To use this module, you need to open a filter via `Technical settings` and +check or uncheck the ``Active`` checkbox. + +* go to ... +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/149/8.0 + +For further information, please visit: + +* https://www.odoo.com/forum/help-1 + +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 +------------ + +* Holger Brunn + +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/base_ir_filters_active/__init__.py b/base_ir_filters_active/__init__.py new file mode 100644 index 000000000..7eda98a23 --- /dev/null +++ b/base_ir_filters_active/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# © 2016 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from . import models diff --git a/base_ir_filters_active/__openerp__.py b/base_ir_filters_active/__openerp__.py new file mode 100644 index 000000000..54d036df4 --- /dev/null +++ b/base_ir_filters_active/__openerp__.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# © 2016 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "Disable filters", + "version": "8.0.1.0.0", + "author": "Therp BV,Odoo Community Association (OCA)", + "license": "AGPL-3", + "category": "Hidden/Dependency", + "summary": "Allows you to disable (hide) filters", + "depends": [ + 'base', + ], + "data": [ + "views/ir_filters.xml", + ], +} diff --git a/base_ir_filters_active/models/__init__.py b/base_ir_filters_active/models/__init__.py new file mode 100644 index 000000000..ebcabfeb4 --- /dev/null +++ b/base_ir_filters_active/models/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# © 2016 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from . import ir_filters diff --git a/base_ir_filters_active/models/ir_filters.py b/base_ir_filters_active/models/ir_filters.py new file mode 100644 index 000000000..6e5e8b3cc --- /dev/null +++ b/base_ir_filters_active/models/ir_filters.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# © 2016 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from openerp import fields, models + + +class IrFilters(models.Model): + _inherit = 'ir.filters' + + active = fields.Boolean(default=True) diff --git a/base_ir_filters_active/static/description/icon.png b/base_ir_filters_active/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/base_ir_filters_active/static/description/icon.png differ diff --git a/base_ir_filters_active/tests/__init__.py b/base_ir_filters_active/tests/__init__.py new file mode 100644 index 000000000..22bd5dd10 --- /dev/null +++ b/base_ir_filters_active/tests/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# © 2016 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from . import test_base_ir_filters_active diff --git a/base_ir_filters_active/tests/test_base_ir_filters_active.py b/base_ir_filters_active/tests/test_base_ir_filters_active.py new file mode 100644 index 000000000..e21dbafee --- /dev/null +++ b/base_ir_filters_active/tests/test_base_ir_filters_active.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# © 2016 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from openerp.tests.common import TransactionCase + + +class TestBaseIrFiltersActive(TransactionCase): + def test_base_ir_filters_active(self): + new_filter = self.env['ir.filters'].create({ + 'name': 'inactive testfilter', + 'user_id': False, + 'domain': '[]', + 'context': '{}', + 'model_id': 'ir.filters', + 'active': False, + }) + self.assertFalse(self.env['ir.filters'].search([]) & new_filter) + self.assertTrue( + self.env['ir.filters'].with_context(active_test=False).search([]) & + new_filter) diff --git a/base_ir_filters_active/views/ir_filters.xml b/base_ir_filters_active/views/ir_filters.xml new file mode 100644 index 000000000..9c113e821 --- /dev/null +++ b/base_ir_filters_active/views/ir_filters.xml @@ -0,0 +1,32 @@ + + + + + ir.filters + + + + + + + + + ir.filters + + + + + + + + + ir.filters + + + + + + + + +