Browse files

[IMP] base, mail: For the activity view, manage a 'create' button vis…

…ibility on search create popup based on access rights.
  • Loading branch information...
hbh-odoo committed Feb 11, 2019
1 parent a2b5ac5 commit d98414aef8cd8fbea5760a0a677a4e826a4ffd14
@@ -525,7 +525,6 @@ def get_activity_data(self, res_model, domain):
'activity_types': activity_type_infos,
'activity_res_ids': sorted(res_id_to_deadline, key=lambda item: res_id_to_deadline[item]),
'grouped_activities': activity_data,
'can_create': self.env[res_model].check_access_rights('create', raise_exception=False),

@@ -238,7 +238,7 @@ var ActivityRenderer = AbstractRenderer.extend({
res_model: this.state.model,
domain: this.state.domain,
title: _.str.sprintf(_t("Search: %s"), this.arch.attrs.string),
no_create: !this.state.can_create,
no_create: this.arch.attrs.create ? !JSON.parse(this.arch.attrs.create) : false,
disable_multiple_selection: true,
on_selected: function (record) {
var KanbanActivity = field_registry.get('kanban_activity');
@@ -10,6 +10,7 @@
<define name="activity">
<element name="activity">
<attribute name="string"/>
<optional><attribute name="create"/></optional>
<oneOrMore><ref name="field"/></oneOrMore>
@@ -1124,7 +1124,7 @@ def _postprocess_access_rights(self, model, node):
not self._context.get("create", True) and is_base_model):
node.set("create", 'false')

if node.tag in ('kanban', 'tree', 'form', 'gantt'):
if node.tag in ('kanban', 'tree', 'form', 'gantt', '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

0 comments on commit d98414a

Please sign in to comment.