fix(frappe_crm_api): handle failure for after_app_install and after_app_uninstall

(cherry picked from commit 2de423e225)
This commit is contained in:
diptanilsaha
2026-07-09 12:23:19 +05:30
committed by Mergify
parent 0a5daeed57
commit 983ec5660c

View File

@@ -192,22 +192,28 @@ def is_crm_installed():
def remove_allowed_users_on_crm_install():
CRMSettings = frappe.get_single("CRM Settings")
try:
CRMSettings = frappe.get_single("CRM Settings")
if not CRMSettings.enable_frappe_crm_data_synchronization:
return
if not CRMSettings.enable_frappe_crm_data_synchronization:
return
CRMSettings.allowed_users = []
CRMSettings.save()
click.secho("Removed Allowed Users from CRM Settings.")
CRMSettings.allowed_users = []
CRMSettings.save()
click.secho("Removed 'Allowed Users' from CRM Settings.")
except Exception:
click.secho("'Allowed Users' from CRM Settings couldn't be cleared.")
def disable_frappe_crm_data_synchronization_on_crm_uninstall():
CRMSettings = frappe.get_single("CRM Settings")
try:
CRMSettings = frappe.get_single("CRM Settings")
if not CRMSettings.enable_frappe_crm_data_synchronization:
return
if not CRMSettings.enable_frappe_crm_data_synchronization:
return
CRMSettings.enable_frappe_crm_data_synchronization = 0
CRMSettings.save()
click.secho("Enable Frappe CRM Data Synchronization on CRM Settings has been disabled.")
CRMSettings.enable_frappe_crm_data_synchronization = 0
CRMSettings.save()
click.secho("'Enable Frappe CRM Data Synchronization' on CRM Settings has been disabled.")
except Exception:
click.secho("'Enable Frappe CRM Data Synchronization' on CRM Settings could not be disabled.")