diff --git a/utility_billing/utility_billing/doctype/request_for_utility_service/request_for_utility_service.js b/utility_billing/utility_billing/doctype/request_for_utility_service/request_for_utility_service.js index d56e2cd..f0651e1 100644 --- a/utility_billing/utility_billing/doctype/request_for_utility_service/request_for_utility_service.js +++ b/utility_billing/utility_billing/doctype/request_for_utility_service/request_for_utility_service.js @@ -1,8 +1,11 @@ // Copyright (c) 2024, Navari and contributors // For license information, please see license.txt -// frappe.ui.form.on("Request for Utility Service", { -// refresh(frm) { - -// }, -// }); +frappe.ui.form.on("Request for Utility Service", { + refresh: function (frm) { + frm.toggle_display("address_html", !frm.is_new()); + if (!frm.is_new()) { + frappe.contacts.render_address_and_contact(frm); + } + }, +}); diff --git a/utility_billing/utility_billing/doctype/request_for_utility_service/request_for_utility_service.json b/utility_billing/utility_billing/doctype/request_for_utility_service/request_for_utility_service.json index 8df8c86..fc42443 100644 --- a/utility_billing/utility_billing/doctype/request_for_utility_service/request_for_utility_service.json +++ b/utility_billing/utility_billing/doctype/request_for_utility_service/request_for_utility_service.json @@ -28,16 +28,9 @@ "section_break_asmx", "amended_from", "address_and_contacts_tab", - "address", - "town", - "residential_area", - "street_name", - "plothouse_no", + "address_html", "column_break_kzdt", - "contact", - "postal_address", - "telephonecell_no", - "email_address", + "contact_html", "section_break_lpoa", "connection_size", "water_network", @@ -163,24 +156,12 @@ { "fieldname": "address_and_contacts_tab", "fieldtype": "Tab Break", - "label": "Address and Contacts" - }, - { - "fieldname": "address", - "fieldtype": "Link", - "label": "Address", - "options": "Address" + "label": "Address & Contacts" }, { "fieldname": "column_break_kzdt", "fieldtype": "Column Break" }, - { - "fieldname": "contact", - "fieldtype": "Link", - "label": "Contact", - "options": "Contact" - }, { "fieldname": "section_break_lpoa", "fieldtype": "Section Break" @@ -211,45 +192,22 @@ "label": "Pipes type/Distance" }, { - "fieldname": "town", - "fieldtype": "Data", - "label": "Town" - }, - { - "fieldname": "residential_area", - "fieldtype": "Data", - "label": "Residential Area" - }, - { - "fieldname": "street_name", - "fieldtype": "Data", - "label": "Street Name" - }, - { - "fieldname": "plothouse_no", - "fieldtype": "Data", - "label": "Plot/House no" - }, - { - "fieldname": "postal_address", - "fieldtype": "Data", - "label": "Postal Address" - }, - { - "fieldname": "telephonecell_no", - "fieldtype": "Data", - "label": "Telephone/Cell no" + "fieldname": "address_html", + "fieldtype": "HTML", + "label": "Address HTML", + "options": "Address" }, { - "fieldname": "email_address", - "fieldtype": "Data", - "label": "Email Address\t" + "fieldname": "contact_html", + "fieldtype": "HTML", + "label": "Contact", + "options": "Contact" } ], "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2024-10-09 08:31:10.144297", + "modified": "2024-10-09 15:32:10.619999", "modified_by": "Administrator", "module": "Utility Billing", "name": "Request for Utility Service", diff --git a/utility_billing/utility_billing/doctype/request_for_utility_service/request_for_utility_service.py b/utility_billing/utility_billing/doctype/request_for_utility_service/request_for_utility_service.py index bd6503e..a8b343e 100644 --- a/utility_billing/utility_billing/doctype/request_for_utility_service/request_for_utility_service.py +++ b/utility_billing/utility_billing/doctype/request_for_utility_service/request_for_utility_service.py @@ -1,9 +1,12 @@ # Copyright (c) 2024, Navari and contributors # For license information, please see license.txt +from frappe.contacts.address_and_contact import load_address_and_contact + # import frappe from frappe.model.document import Document class RequestforUtilityService(Document): - pass + def onload(self): + load_address_and_contact(self)