From f3367317a298b651136d3ae5af4f3ff87f14a1e4 Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Mon, 15 Jul 2024 23:25:03 +0200 Subject: [PATCH] refactor: move permissions for report "DATEV" Resolves #16 --- erpnext_datev/erpnext_datev/report/datev/datev.json | 13 ++++++++++--- erpnext_datev/install.py | 13 ------------- erpnext_datev/patches.txt | 4 ++++ 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/erpnext_datev/erpnext_datev/report/datev/datev.json b/erpnext_datev/erpnext_datev/report/datev/datev.json index 1d666db..e84b43e 100644 --- a/erpnext_datev/erpnext_datev/report/datev/datev.json +++ b/erpnext_datev/erpnext_datev/report/datev/datev.json @@ -2,14 +2,14 @@ "add_total_row": 0, "columns": [], "creation": "2022-02-17 23:29:46.760108", - "disable_prepared_report": 0, "disabled": 0, "docstatus": 0, "doctype": "Report", "filters": [], "idx": 0, "is_standard": "Yes", - "modified": "2022-04-13 04:22:14.774093", + "letterhead": null, + "modified": "2024-07-15 23:10:51.572551", "modified_by": "Administrator", "module": "Erpnext Datev", "name": "DATEV", @@ -18,5 +18,12 @@ "ref_doctype": "GL Entry", "report_name": "DATEV", "report_type": "Script Report", - "roles": [] + "roles": [ + { + "role": "Accounts User" + }, + { + "role": "Accounts Manager" + } + ] } \ No newline at end of file diff --git a/erpnext_datev/install.py b/erpnext_datev/install.py index c771a58..b266ed6 100644 --- a/erpnext_datev/install.py +++ b/erpnext_datev/install.py @@ -4,7 +4,6 @@ def after_install(): make_custom_fields() - add_custom_roles_for_reports() def make_custom_fields(): @@ -21,15 +20,3 @@ def make_custom_fields(): } create_custom_fields(custom_fields) - - -def add_custom_roles_for_reports(): - """Add Access Control to DATEV.""" - if not frappe.db.get_value("Custom Role", dict(report="DATEV")): - frappe.get_doc( - dict( - doctype="Custom Role", - report="DATEV", - roles=[dict(role="Accounts User"), dict(role="Accounts Manager")], - ) - ).insert() diff --git a/erpnext_datev/patches.txt b/erpnext_datev/patches.txt index e69de29..e411618 100644 --- a/erpnext_datev/patches.txt +++ b/erpnext_datev/patches.txt @@ -0,0 +1,4 @@ +[pre_model_sync] + +[post_model_sync] +execute:frappe.db.delete("Custom Role", {"report": "DATEV"})