Skip to content

Commit

Permalink
fix: customizations leaks, module specificity (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
agritheory authored Sep 14, 2023
1 parent 78d2666 commit ce6b9fc
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 193 deletions.
1 change: 1 addition & 0 deletions check_run/check_run/custom/bank.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"mandatory_depends_on": null,
"modified": "2022-08-07 15:07:53.297493",
"modified_by": "Administrator",
"module": "Check Run",
"name": "Bank-aba_number",
"no_copy": 0,
"non_negative": 0,
Expand Down
1 change: 1 addition & 0 deletions check_run/check_run/custom/bank_account.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"length": 0,
"mandatory_depends_on": null,
"modified": "2022-06-30 11:20:02.666689",
"module": "Check Run",
"modified_by": "Administrator",
"name": "Bank Account-check_number",
"no_copy": 0,
Expand Down
3 changes: 2 additions & 1 deletion check_run/check_run/custom/mode_of_payment.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"idx": 0,
"modified": "2022-08-05 13:10:55.278054",
"modified_by": "Administrator",
"module": "Check Run",
"name": "Mode of Payment-type-options",
"owner": "Administrator",
"parent": null,
Expand All @@ -29,4 +30,4 @@
}
],
"sync_on_migrate": 1
}
}
1 change: 1 addition & 0 deletions check_run/check_run/custom/payment_entry.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"mandatory_depends_on": null,
"modified": "2022-06-30 11:20:02.666689",
"modified_by": "Administrator",
"module": "Check Run",
"name": "Payment Entry-check_run",
"no_copy": 0,
"non_negative": 0,
Expand Down
1 change: 1 addition & 0 deletions check_run/check_run/custom/purchase_invoice.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"mandatory_depends_on": null,
"modified": "2022-06-30 11:20:02.666689",
"modified_by": "Administrator",
"module": "Check Run",
"name": "Purchase Invoice-supplier_default_mode_of_payment",
"no_copy": 0,
"non_negative": 0,
Expand Down
195 changes: 3 additions & 192 deletions check_run/check_run/custom/supplier.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"mandatory_depends_on": null,
"modified": "2022-06-30 11:20:02.666689",
"modified_by": "Administrator",
"module": null,
"module": "Check Run",
"name": "Supplier-bank_account",
"no_copy": 0,
"non_negative": 0,
Expand Down Expand Up @@ -100,7 +100,7 @@
"mandatory_depends_on": null,
"modified": "2022-06-30 11:20:02.666689",
"modified_by": "Administrator",
"module": null,
"module": "Check Run",
"name": "Supplier-supplier_default_mode_of_payment",
"no_copy": 0,
"non_negative": 0,
Expand All @@ -119,199 +119,10 @@
"translatable": 0,
"unique": 0,
"width": null
},
{
"_assign": null,
"_comments": null,
"_liked_by": null,
"_user_tags": null,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"creation": "2023-02-28 11:16:08.858761",
"default": null,
"depends_on": null,
"description": null,
"docstatus": 0,
"dt": "Supplier",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "irs_1099",
"fieldtype": "Check",
"hidden": 0,
"hide_border": 0,
"hide_days": 0,
"hide_seconds": 0,
"idx": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_preview": 0,
"in_standard_filter": 0,
"insert_after": "tax_id",
"is_system_generated": 1,
"is_virtual": 0,
"label": "Is IRS 1099 reporting required for supplier?",
"length": 0,
"mandatory_depends_on": null,
"modified": "2023-02-28 11:16:08.858761",
"modified_by": "Administrator",
"module": null,
"name": "Supplier-irs_1099",
"no_copy": 0,
"non_negative": 0,
"options": null,
"owner": "Administrator",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": null,
"read_only": 0,
"read_only_depends_on": null,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"translatable": 1,
"unique": 0,
"width": null
},
{
"_assign": null,
"_comments": null,
"_liked_by": null,
"_user_tags": null,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"creation": "2022-06-30 11:20:02.666689",
"default": null,
"depends_on": null,
"description": null,
"docstatus": 0,
"dt": "Supplier",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "bank",
"fieldtype": "Link",
"hidden": 0,
"hide_border": 0,
"hide_days": 0,
"hide_seconds": 0,
"idx": 33,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_preview": 0,
"in_standard_filter": 0,
"insert_after": "supplier_default_mode_of_payment",
"is_system_generated": 0,
"is_virtual": 0,
"label": "Bank",
"length": 0,
"mandatory_depends_on": null,
"modified": "2023-02-28 11:29:22.518036",
"modified_by": "Administrator",
"module": null,
"name": "Supplier-bank",
"no_copy": 0,
"non_negative": 0,
"options": "Bank",
"owner": "Administrator",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": null,
"read_only": 0,
"read_only_depends_on": null,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"translatable": 0,
"unique": 0,
"width": null
}
],
"custom_perms": [],
"doctype": "Supplier",
"links": [
{
"creation": "2013-01-10 16:34:11",
"custom": 0,
"docstatus": 0,
"group": "Allowed Items",
"hidden": 0,
"idx": 1,
"is_child_table": 0,
"link_doctype": "Party Specific Item",
"link_fieldname": "party",
"modified": "2023-02-28 21:44:41.878474",
"modified_by": "Administrator",
"name": "62e88989a8",
"owner": "Administrator",
"parent": "Supplier",
"parent_doctype": null,
"parentfield": "links",
"parenttype": "DocType",
"table_fieldname": null
}
],
"property_setters": [
{
"_assign": null,
"_comments": null,
"_liked_by": null,
"_user_tags": null,
"creation": "2023-02-28 11:16:11.179371",
"default_value": null,
"doc_type": "Supplier",
"docstatus": 0,
"doctype_or_field": "DocField",
"field_name": "naming_series",
"idx": 0,
"is_system_generated": 0,
"modified": "2023-02-28 11:16:11.179371",
"modified_by": "Administrator",
"module": null,
"name": "Supplier-naming_series-hidden",
"owner": "Administrator",
"property": "hidden",
"property_type": "Check",
"row_name": null,
"value": "1"
},
{
"_assign": null,
"_comments": null,
"_liked_by": null,
"_user_tags": null,
"creation": "2023-02-28 11:16:11.027773",
"default_value": null,
"doc_type": "Supplier",
"docstatus": 0,
"doctype_or_field": "DocField",
"field_name": "naming_series",
"idx": 0,
"is_system_generated": 0,
"modified": "2023-02-28 11:16:11.027773",
"modified_by": "Administrator",
"module": null,
"name": "Supplier-naming_series-reqd",
"owner": "Administrator",
"property": "reqd",
"property_type": "Check",
"row_name": null,
"value": "0"
}
],
"property_setters": [],
"sync_on_migrate": 1
}
4 changes: 4 additions & 0 deletions check_run/customize.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def load_customizations():
for file in files:
customizations = json.loads(Path(file).read_text())
for field in customizations.get("custom_fields"):
if field.get("module") != "Check Run":
continue
existing_field = frappe.get_value("Custom Field", field.get("name"))
custom_field = (
frappe.get_doc("Custom Field", field.get("name"))
Expand All @@ -24,6 +26,8 @@ def load_customizations():
custom_field.flags.ignore_version = True
custom_field.save()
for prop in customizations.get("property_setters"):
if prop.get("module") != "Check Run":
continue
property_setter = frappe.get_doc(
{
"name": prop.get("name"),
Expand Down

0 comments on commit ce6b9fc

Please sign in to comment.