From 4b8af06d8a9477ffabe2aa220f0ed910a79b2344 Mon Sep 17 00:00:00 2001 From: jem-odoo Date: Thu, 8 Aug 2019 15:47:53 +0000 Subject: [PATCH] [IMP] base: extract gantt validation All views defined in the 'enterprise' addons have their validation done manually in their respective addons. Each one ? No, one rebel still resists to the standart way to work. This commit moves the gantt validation to put it in its module. The idea is (for developper) to have only one module to change when adding feature in gantt view. Task-2050019 --- odoo/addons/base/models/ir_ui_view.py | 2 +- odoo/addons/base/rng/gantt_view.rng | 71 --------------------------- odoo/tools/view_validation.py | 2 +- 3 files changed, 2 insertions(+), 73 deletions(-) delete mode 100644 odoo/addons/base/rng/gantt_view.rng diff --git a/odoo/addons/base/models/ir_ui_view.py b/odoo/addons/base/models/ir_ui_view.py index 0234662644a..bf1f62381f3 100644 --- a/odoo/addons/base/models/ir_ui_view.py +++ b/odoo/addons/base/models/ir_ui_view.py @@ -976,7 +976,7 @@ actual arch. not self._context.get("create", True) and is_base_model): node.set("create", 'false') - if node.tag in ('kanban', 'tree', 'form', 'gantt', 'activity'): + if node.tag in ('kanban', 'tree', 'form', 'activity'): for action, operation in (('create', 'create'), ('delete', 'unlink'), ('edit', 'write')): if (not node.get(action) and not Model.check_access_rights(operation, raise_exception=False) or diff --git a/odoo/addons/base/rng/gantt_view.rng b/odoo/addons/base/rng/gantt_view.rng deleted file mode 100644 index 2180800c8de..00000000000 --- a/odoo/addons/base/rng/gantt_view.rng +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - day - week - month - year - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/odoo/tools/view_validation.py b/odoo/tools/view_validation.py index 9751c386a2b..f135e52dc3a 100644 --- a/odoo/tools/view_validation.py +++ b/odoo/tools/view_validation.py @@ -183,7 +183,7 @@ def relaxng(view_type): return _relaxng_cache[view_type] -@validate('calendar', 'diagram', 'gantt', 'graph', 'pivot', 'search', 'tree', 'activity') +@validate('calendar', 'diagram', 'graph', 'pivot', 'search', 'tree', 'activity') def schema_valid(arch, **kwargs): """ Get RNG validator and validate RNG file.""" validator = relaxng(arch.tag)