From b7de5398a788d62c3ef45afa3a7581684fece82a Mon Sep 17 00:00:00 2001 From: maasanto <73234812+maasanto@users.noreply.github.com> Date: Mon, 26 May 2025 13:45:46 +0200 Subject: [PATCH] chore: Remove agriculture roles (#47335) * feat: remove permissions of Agriculture Manager and Agriculture User * feat: patch to remove agriculture roles * chore: formatting issue --------- Co-authored-by: ruthra kumar --- erpnext/assets/doctype/location/location.json | 27 +++---------------- erpnext/patches.txt | 1 + .../patches/v15_0/remove_agriculture_roles.py | 12 +++++++++ 3 files changed, 16 insertions(+), 24 deletions(-) create mode 100644 erpnext/patches/v15_0/remove_agriculture_roles.py diff --git a/erpnext/assets/doctype/location/location.json b/erpnext/assets/doctype/location/location.json index 7efc3e9036e..bcba2d8aba2 100644 --- a/erpnext/assets/doctype/location/location.json +++ b/erpnext/assets/doctype/location/location.json @@ -143,7 +143,7 @@ ], "is_tree": 1, "links": [], - "modified": "2025-01-22 10:47:32.581537", + "modified": "2025-04-29 13:53:13.488906", "modified_by": "Administrator", "module": "Assets", "name": "Location", @@ -198,34 +198,13 @@ "role": "Stock Manager", "share": 1, "write": 1 - }, - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "Agriculture Manager", - "share": 1, - "write": 1 - }, - { - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "Agriculture User", - "share": 1, - "write": 1 } ], "quick_entry": 1, + "row_format": "Dynamic", "show_name_in_global_search": 1, "sort_field": "creation", "sort_order": "DESC", "states": [], "track_changes": 1 -} \ No newline at end of file +} diff --git a/erpnext/patches.txt b/erpnext/patches.txt index b9741620d73..143ec05455d 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -414,3 +414,4 @@ erpnext.patches.v15_0.update_journal_entry_type erpnext.patches.v15_0.set_grand_total_to_default_mop execute:frappe.db.set_single_value("Accounts Settings", "use_new_budget_controller", True) erpnext.patches.v15_0.rename_group_by_to_categorize_by_in_custom_reports +erpnext.patches.v15_0.remove_agriculture_roles diff --git a/erpnext/patches/v15_0/remove_agriculture_roles.py b/erpnext/patches/v15_0/remove_agriculture_roles.py new file mode 100644 index 00000000000..fb015cefc13 --- /dev/null +++ b/erpnext/patches/v15_0/remove_agriculture_roles.py @@ -0,0 +1,12 @@ +import frappe + + +def execute(): + if "agriculture" in frappe.get_installed_apps(): + return + + for role in ["Agriculture User", "Agriculture Manager"]: + assignments = frappe.get_all("Has Role", {"role": role}, pluck="name") + for assignment in assignments: + frappe.delete_doc("Has Role", assignment, ignore_missing=True, force=True) + frappe.delete_doc("Role", role, ignore_missing=True, force=True)