Browse Source

[ADD] base_ir_filters_disable

pull/397/head
Holger Brunn 9 years ago
parent
commit
754f0c0408
  1. 56
      base_ir_filters_disable/README.rst
  2. 4
      base_ir_filters_disable/__init__.py
  3. 17
      base_ir_filters_disable/__openerp__.py
  4. 4
      base_ir_filters_disable/models/__init__.py
  5. 10
      base_ir_filters_disable/models/ir_filters.py
  6. BIN
      base_ir_filters_disable/static/description/icon.png
  7. 4
      base_ir_filters_disable/tests/__init__.py
  8. 20
      base_ir_filters_disable/tests/test_base_ir_filters_disable.py
  9. 32
      base_ir_filters_disable/views/ir_filters.xml

56
base_ir_filters_disable/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 <https://github.com/OCA/server-tools/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 <https://github.com/OCA/server-tools/issues/new?body=module:%20base_ir_filters_disable%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
Contributors
------------
* Holger Brunn <hbrunn@therp.nl>
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.

4
base_ir_filters_disable/__init__.py

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models

17
base_ir_filters_disable/__openerp__.py

@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# 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",
],
}

4
base_ir_filters_disable/models/__init__.py

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import ir_filters

10
base_ir_filters_disable/models/ir_filters.py

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, fields, models
class IrFilters(models.Model):
_inherit = 'ir.filters'
active = fields.Boolean(default=True)

BIN
base_ir_filters_disable/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

4
base_ir_filters_disable/tests/__init__.py

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import test_base_ir_filters_disable

20
base_ir_filters_disable/tests/test_base_ir_filters_disable.py

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.tests.common import TransactionCase
class TestBaseIrFiltersDisable(TransactionCase):
def test_base_ir_filters_disable(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)

32
base_ir_filters_disable/views/ir_filters.xml

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="ir_filters_view_form" model="ir.ui.view">
<field name="model">ir.filters</field>
<field name="inherit_id" ref="base.ir_filters_view_form" />
<field name="arch" type="xml">
<field name="action_id" position="after">
<field name="active" />
</field>
</field>
</record>
<record id="ir_filters_view_tree" model="ir.ui.view">
<field name="model">ir.filters</field>
<field name="inherit_id" ref="base.ir_filters_view_tree" />
<field name="arch" type="xml">
<field name="is_default" position="after">
<field name="active" />
</field>
</field>
</record>
<record id="ir_filters_view_search" model="ir.ui.view">
<field name="model">ir.filters</field>
<field name="inherit_id" ref="base.ir_filters_view_search" />
<field name="arch" type="xml">
<xpath expr="." position="inside">
<filter name="show_inactive" string="Show inactive" context="{'active_test': False}" />
</xpath>
</field>
</record>
</data>
</openerp>
Loading…
Cancel
Save