Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions project_customer_access/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
# https://github.com/OCA/server-auth
"cross_connect_server",
],
"assets": {
"web.assets_backend": [
"project_customer_access/static/src/js/export_all_patch.esm.js",
],
},
"data": [
"data/res_groups.xml",
"security/ir.model.access.csv",
Expand Down
8 changes: 8 additions & 0 deletions project_customer_access/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,11 @@ def write(self, values):
self.env = self.sudo().env

return super().write(values)

def export_data(self, fields_to_export):
# Allow manager to export the list view to excel
# TODO we couuld add a check on the fields_to_export list to check there are
# no critical field
if self.env.user.has_group("project_customer_access.group_manager"):
return super(ProjectTask, self.sudo()).export_data(fields_to_export)
return super().export_data(fields_to_export)
16 changes: 16 additions & 0 deletions project_customer_access/static/src/js/export_all_patch.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {registry} from "@web/core/registry";
import {user} from "@web/core/user";

const cogMenuRegistry = registry.category("cogMenu");

const exportAllItem = cogMenuRegistry.get("export-all-menu");

const originalIsDisplayed = exportAllItem.isDisplayed;

exportAllItem.isDisplayed = async (env) => {
const baseCondition = await originalIsDisplayed(env);
const hasMyCustomGroup = await user.hasGroup(
"project_customer_access.group_manager"
);
return baseCondition || hasMyCustomGroup;
};
Loading