From 249938220cbf14b5a6dada9a911919e464d57ced Mon Sep 17 00:00:00 2001 From: projectsodoo Date: Fri, 25 Dec 2020 16:31:30 +0530 Subject: [PATCH] Gantt chat added day,month,week --- .../src/js/planning_gantt_controller.js | 3 +- web_gantt/models/ir_ui_view.py | 31 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/planning/static/src/js/planning_gantt_controller.js b/planning/static/src/js/planning_gantt_controller.js index 5da02b0..bb91f57 100755 --- a/planning/static/src/js/planning_gantt_controller.js +++ b/planning/static/src/js/planning_gantt_controller.js @@ -23,7 +23,8 @@ var PlanningGanttController = GanttController.extend({ * @param {jQueryElement} $node to which the buttons will be appended */ renderButtons: function ($node) { - if ($node) { + //if ($node) { + if (this.model && this.model.get()) { var state = this.model.get(); this.$buttons = $(QWeb.render('PlanningGanttView.buttons', { groupedBy: state.groupedBy, diff --git a/web_gantt/models/ir_ui_view.py b/web_gantt/models/ir_ui_view.py index f865047..2eb979a 100755 --- a/web_gantt/models/ir_ui_view.py +++ b/web_gantt/models/ir_ui_view.py @@ -24,3 +24,34 @@ class View(models.Model): node.set(action, 'false') return node + + """def _postprocess_access_rights(self, model, node): + Model = self.env[model].sudo(False) + is_base_model = self.env.context.get('base_model_name', model) == model + if node.tag in ('gantt'): + for action, operation in (('create', 'create'), ('edit', 'write')): + if (not node.get(action) and + not Model.check_access_rights(operation, raise_exception=False) or + not self._context.get(action, True) and is_base_model): + node.set(action, 'false') + + 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 + not self._context.get(action, True) and is_base_model): + node.set(action, 'false') + + if node.tag == 'kanban': + group_by_name = node.get('default_group_by') + group_by_field = Model._fields.get(group_by_name) + if group_by_field and group_by_field.type == 'many2one': + group_by_model = Model.env[group_by_field.comodel_name] + for action, operation in ( + ('group_create', 'create'), ('group_delete', 'unlink'), ('group_edit', 'write')): + if (not node.get(action) and + not group_by_model.check_access_rights(operation, raise_exception=False) or + not self._context.get(action, True) and is_base_model): + node.set(action, 'false')""" + +