Files
erpnext/erpnext/patches/v15_0/remove_agriculture_roles.py
maasanto b7de5398a7 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 <ruthra@erpnext.com>
2025-05-26 17:15:46 +05:30

13 lines
400 B
Python

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)