-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Customer creation on submit - Request for Utility Service
- Loading branch information
1 parent
4b0408b
commit 023067b
Showing
2 changed files
with
18 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 16 additions & 2 deletions
18
...illing/utility_billing/doctype/request_for_utility_service/request_for_utility_service.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |