From 4b89ddffde3afd7e174c152cbad3b48a59d551c2 Mon Sep 17 00:00:00 2001 From: AarDG10 Date: Mon, 31 Aug 2026 11:09:09 +0530 Subject: [PATCH 1/2] fix(sms_settings): add patch to pre-fill roles into SMS Settings Roles Table (cherry picked from commit 3501beb2bd40a56e50d12649697f7cafc6ffc46f) # Conflicts: # erpnext/patches.txt --- erpnext/patches.txt | 5 +++ .../add_transaction_roles_to_sms_settings.py | 39 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 erpnext/patches/v16_0/add_transaction_roles_to_sms_settings.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 9515106aade..928749abbd0 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -502,6 +502,11 @@ erpnext.patches.v16_0.recalculate_purchase_receipt_billing_status erpnext.patches.v16_0.add_currency_to_blanket_orders erpnext.patches.v16_0.repair_work_order_material_transfer erpnext.patches.v16_0.remove_frappe_crm_custom_fields +<<<<<<< HEAD erpnext.patches.v16_0.rename_secondary_item_type_field erpnext.patches.v16_0.append_fieldname_to_pos_search_fields erpnext.patches.v16_0.set_secondary_item_valuation_type +======= +erpnext.patches.v16_0.add_batch_split_stock_entry_type +erpnext.patches.v16_0.add_transaction_roles_to_sms_settings +>>>>>>> 3501beb (fix(sms_settings): add patch to pre-fill roles into SMS Settings Roles Table) diff --git a/erpnext/patches/v16_0/add_transaction_roles_to_sms_settings.py b/erpnext/patches/v16_0/add_transaction_roles_to_sms_settings.py new file mode 100644 index 00000000000..c287c838091 --- /dev/null +++ b/erpnext/patches/v16_0/add_transaction_roles_to_sms_settings.py @@ -0,0 +1,39 @@ +import frappe +from frappe import _ + +STANDARD_TRANSACTION_ROLES = [ + "Sales User", + "Sales Manager", + "Purchase User", + "Purchase Manager", + "Stock User", + "Stock Manager", + "Accounts User", + "Accounts Manager", +] + + +def execute(): + """Seed SMS Settings.allowed_roles with ERPNext's standard transaction roles.""" + frappe.reload_doctype("SMS Settings") + + if not frappe.get_meta("SMS Settings").has_field("allowed_roles"): + frappe.throw( + _( + "SMS Settings.allowed_roles not found. Update the Frappe Framework app to a " + "version that includes this field, then re-run bench migrate." + ) + ) + + sms_settings = frappe.get_single("SMS Settings") + existing_roles = {d.role for d in sms_settings.get("allowed_roles")} + + added = False + for role in STANDARD_TRANSACTION_ROLES: + if role not in existing_roles and frappe.db.exists("Role", role): + sms_settings.append("allowed_roles", {"role": role}) + added = True + + if added: + sms_settings.flags.ignore_mandatory = True + sms_settings.save() From 9ee421424fb2c970476419ae379d80178ac4cf27 Mon Sep 17 00:00:00 2001 From: AarDG10 Date: Tue, 1 Sep 2026 12:51:04 +0530 Subject: [PATCH 2/2] chore: resolve conflicts --- erpnext/patches.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 928749abbd0..4948c6916f6 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -502,11 +502,7 @@ erpnext.patches.v16_0.recalculate_purchase_receipt_billing_status erpnext.patches.v16_0.add_currency_to_blanket_orders erpnext.patches.v16_0.repair_work_order_material_transfer erpnext.patches.v16_0.remove_frappe_crm_custom_fields -<<<<<<< HEAD erpnext.patches.v16_0.rename_secondary_item_type_field erpnext.patches.v16_0.append_fieldname_to_pos_search_fields erpnext.patches.v16_0.set_secondary_item_valuation_type -======= -erpnext.patches.v16_0.add_batch_split_stock_entry_type erpnext.patches.v16_0.add_transaction_roles_to_sms_settings ->>>>>>> 3501beb (fix(sms_settings): add patch to pre-fill roles into SMS Settings Roles Table)