Skip to content

Commit

Permalink
chore:client script and fixtures hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
muruthigitau committed Oct 3, 2024
1 parent b5d5c37 commit 68d20e3
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
13 changes: 13 additions & 0 deletions utility_billing/fixtures/client_script.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
{
"docstatus": 0,
"doctype": "Client Script",
"dt": "Item Price",
"enabled": 1,
"modified": "2024-10-03 10:36:00.652247",
"module": "Utility Billing",
"name": "Item Price Tariff",
"script": "frappe.ui.form.on('Item Price', {\n refresh: function(frm) {\n check_and_set_rate_zero(frm);\n },\n\n custom_item_price_tariffs: function(frm) {\n check_and_set_rate_zero(frm);\n }\n});\n\n// Helper function to check tariff table and set rate to zero\nfunction check_and_set_rate_zero(frm) {\n if (frm.doc.custom_item_price_tariffs && frm.doc.custom_item_price_tariffs.length > 0) {\n frm.set_value('price_list_rate', 0);\n }\n}\n",
"view": "Form"
}
]
58 changes: 58 additions & 0 deletions utility_billing/fixtures/custom_field.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[
{
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"default": null,
"depends_on": null,
"description": null,
"docstatus": 0,
"doctype": "Custom Field",
"dt": "Item Price",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "custom_item_price_tariffs",
"fieldtype": "Table",
"hidden": 0,
"hide_border": 0,
"hide_days": 0,
"hide_seconds": 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": "section_break_24",
"is_system_generated": 0,
"is_virtual": 0,
"label": "Item Price Tariffs",
"length": 0,
"link_filters": null,
"mandatory_depends_on": null,
"modified": "2024-10-03 10:24:15.852773",
"module": "Stock",
"name": "Item Price-custom_item_price_tariffs",
"no_copy": 0,
"non_negative": 0,
"options": "Item Price Tariff",
"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,
"show_dashboard": 0,
"sort_options": 0,
"translatable": 0,
"unique": 0,
"width": null
}
]
18 changes: 18 additions & 0 deletions utility_billing/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@
app_email = "[email protected]"
app_license = "agpl-3.0"

fixtures = [
{"dt": "Client Script", "filters": [["module", "=", "Utility Billing"]]},
{
"doctype": "Custom Field",
"filters": [
[
"dt",
"in",
(
"Item Price"
),
],
["is_system_generated", "=", 0],
],
},
]


# Apps
# ------------------

Expand Down

0 comments on commit 68d20e3

Please sign in to comment.