Skip to content

Commit

Permalink
feat: Customer creation on submit - Request for Utility Service
Browse files Browse the repository at this point in the history
  • Loading branch information
muruthigitau committed Oct 9, 2024
1 parent 4b0408b commit 023067b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"fieldname": "customer_type",
"fieldtype": "Select",
"label": "Customer Type",
"options": "Customer"
"options": "Company\nIndividual\nPartnership"
},
{
"fieldname": "customer_group",
Expand Down Expand Up @@ -207,7 +207,7 @@
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2024-10-09 15:32:10.619999",
"modified": "2024-10-09 16:16:27.513780",
"modified_by": "Administrator",
"module": "Utility Billing",
"name": "Request for Utility Service",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
# Copyright (c) 2024, Navari and contributors
# For license information, please see license.txt

import frappe
from frappe.contacts.address_and_contact import load_address_and_contact

# import frappe
from frappe.model.document import Document


class RequestforUtilityService(Document):
def onload(self):
load_address_and_contact(self)

def on_submit(self):
if not frappe.db.exists("Customer", self.customer_name):
customer = frappe.get_doc(
{
"doctype": "Customer",
"customer_name": self.customer_name,
"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,
}
)
customer.insert()

0 comments on commit 023067b

Please sign in to comment.