From 0302f601c435dc43bb38a8aaaa74bcbe45d1963c Mon Sep 17 00:00:00 2001 From: muruthigitau Date: Mon, 14 Oct 2024 07:01:40 +0300 Subject: [PATCH] fix: customer creation on submit utility service request --- utility_billing/fixtures/custom_field.json | 72 ++++++++++++++++--- utility_billing/hooks.py | 5 +- .../utility_service_request.json | 14 ++-- .../utility_service_request.py | 5 +- 4 files changed, 78 insertions(+), 18 deletions(-) diff --git a/utility_billing/fixtures/custom_field.json b/utility_billing/fixtures/custom_field.json index 0e83322..015ae23 100644 --- a/utility_billing/fixtures/custom_field.json +++ b/utility_billing/fixtures/custom_field.json @@ -70,7 +70,7 @@ "dt": "BOM", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "utility_request", + "fieldname": "utility_service_request", "fieldtype": "Link", "hidden": 0, "hide_border": 0, @@ -85,16 +85,16 @@ "insert_after": "quantity", "is_system_generated": 0, "is_virtual": 0, - "label": "Utility Request", + "label": "Utility Service Request", "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-10-09 09:02:27.078449", + "modified": "2024-10-14 05:49:24.195096", "module": "Utility Billing", "name": "BOM-custom_utility_request", "no_copy": 0, "non_negative": 0, - "options": "Request for Utility Service", + "options": "Utility Service Request", "permlevel": 0, "precision": "", "print_hide": 0, @@ -223,6 +223,62 @@ "unique": 0, "width": null }, + { + "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": "Customer", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "nrc_or_passport_no", + "fieldtype": "Data", + "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": "customer_group", + "is_system_generated": 0, + "is_virtual": 0, + "label": "NRC or Passport No", + "length": 0, + "link_filters": null, + "mandatory_depends_on": null, + "modified": "2024-10-14 05:53:37.647063", + "module": "Utility Billing", + "name": "Customer-custom_nrc_or_passport_no", + "no_copy": 0, + "non_negative": 0, + "options": null, + "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 + }, { "allow_in_quick_entry": 0, "allow_on_submit": 0, @@ -350,7 +406,7 @@ "dt": "Issue", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "request_for_utility_service", + "fieldname": "utility_service_request", "fieldtype": "Link", "hidden": 0, "hide_border": 0, @@ -365,16 +421,16 @@ "insert_after": "email_account", "is_system_generated": 0, "is_virtual": 0, - "label": "Utility Request", + "label": "Utility Service Request", "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-10-09 09:15:25.004686", + "modified": "2024-10-14 05:31:21.910805", "module": "Utility Billing", "name": "Issue-custom_request_for_utility_service", "no_copy": 0, "non_negative": 0, - "options": "Request for Utility Service", + "options": "Utility Service Request", "permlevel": 0, "precision": "", "print_hide": 0, diff --git a/utility_billing/hooks.py b/utility_billing/hooks.py index 99a13dd..92d1504 100644 --- a/utility_billing/hooks.py +++ b/utility_billing/hooks.py @@ -13,11 +13,12 @@ "dt", "in", ( + "BOM", + "Customer", + "Issue", "Item Price", "Sales Order Item", "Sales Invoice Item", - "Issue", - "BOM", ), ], ["is_system_generated", "=", 0], diff --git a/utility_billing/utility_billing/doctype/utility_service_request/utility_service_request.json b/utility_billing/utility_billing/doctype/utility_service_request/utility_service_request.json index 1e3345b..0a94ed2 100644 --- a/utility_billing/utility_billing/doctype/utility_service_request/utility_service_request.json +++ b/utility_billing/utility_billing/doctype/utility_service_request/utility_service_request.json @@ -13,11 +13,11 @@ "column_break_nqzi", "date", "request_type", - "nrcpassport_no", "territory", "column_break_wxld", "company", "tax_id", + "nrcpassport_no", "section_break_lpoa", "connection_size", "pipes_typedistance", @@ -92,7 +92,8 @@ "in_list_view": 1, "in_preview": 1, "in_standard_filter": 1, - "label": "Name" + "label": "Name", + "reqd": 1 }, { "fieldname": "customer_type", @@ -109,8 +110,9 @@ }, { "fieldname": "territory", - "fieldtype": "Data", - "label": "Territory" + "fieldtype": "Link", + "label": "Territory", + "options": "Territory" }, { "fieldname": "column_break_nqzi", @@ -233,7 +235,7 @@ "fieldtype": "Data", "in_filter": 1, "in_standard_filter": 1, - "label": "Organisation Registration No" + "label": "Tax ID" }, { "fieldname": "section_break_jqrx", @@ -261,7 +263,7 @@ "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2024-10-14 01:52:46.346069", + "modified": "2024-10-14 05:12:30.780832", "modified_by": "Administrator", "module": "Utility Billing", "name": "Utility Service Request", diff --git a/utility_billing/utility_billing/doctype/utility_service_request/utility_service_request.py b/utility_billing/utility_billing/doctype/utility_service_request/utility_service_request.py index e2926dc..26a0905 100644 --- a/utility_billing/utility_billing/doctype/utility_service_request/utility_service_request.py +++ b/utility_billing/utility_billing/doctype/utility_service_request/utility_service_request.py @@ -19,8 +19,9 @@ def on_submit(self): "customer_type": self.customer_type, "customer_group": self.customer_group, "territory": self.territory, - "nrcpassport_no": self.nrcpassport_no, - "organisation_registration_no": self.organisation_registration_no, + "tax_id": self.tax_id, + "nrc_or_passport_no": self.nrcpassport_no, + "company": self.company, } ) customer.insert()