fix: make currency read only once set

This commit is contained in:
Shariq Ansari 2025-07-09 17:49:44 +05:30
parent 37d820a67c
commit 71db65d21c
2 changed files with 21 additions and 1 deletions

View File

@ -8,6 +8,7 @@
"defaults_tab",
"restore_defaults",
"enable_forecasting",
"currency",
"branding_tab",
"brand_name",
"brand_logo",
@ -64,12 +65,20 @@
"fieldname": "enable_forecasting",
"fieldtype": "Check",
"label": "Enable Forecasting"
},
{
"fieldname": "currency",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Currency",
"options": "Currency",
"reqd": 1
}
],
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2025-07-01 13:20:48.757603",
"modified": "2025-07-09 17:49:18.705465",
"modified_by": "Administrator",
"module": "FCRM",
"name": "FCRM Settings",

View File

@ -17,6 +17,7 @@ class FCRMSettings(Document):
def validate(self):
self.do_not_allow_to_delete_if_standard()
self.setup_forecasting()
self.make_currency_read_only()
def do_not_allow_to_delete_if_standard(self):
if not self.has_value_changed("dropdown_items"):
@ -60,6 +61,16 @@ class FCRMSettings(Document):
"Check",
)
def make_currency_read_only(self):
if self.currency and self.has_value_changed("currency"):
make_property_setter(
"FCRM Settings",
"currency",
"read_only",
1,
"Check",
)
def get_standard_dropdown_items():
return [item.get("name1") for item in frappe.get_hooks("standard_dropdown_items")]