Finished Quick Entry
This commit is contained in:
@@ -3,7 +3,7 @@ from frappe import _
|
||||
|
||||
@frappe.whitelist()
|
||||
def create_customer_full(**data):
|
||||
frappe.only_for("System Manager", "Sales User", "Sales Manager")
|
||||
frappe.only_for(["System Manager", "Sales User", "Sales Manager"])
|
||||
|
||||
required = [
|
||||
"customer_name",
|
||||
@@ -26,16 +26,22 @@ def create_customer_full(**data):
|
||||
try:
|
||||
frappe.db.begin()
|
||||
|
||||
if data.get("custom_auto_pay_enabled") and not data.get("custom_auto_pay_id"):
|
||||
frappe.throw("Auto Pay ID is required when Auto Pay is enabled.")
|
||||
|
||||
|
||||
customer = frappe.get_doc({
|
||||
"doctype": "Customer",
|
||||
"customer_name": data["customer_name"],
|
||||
"customer_type": data["customer_type"],
|
||||
"customer_group": data["customer_group"],
|
||||
"territory": "United States",
|
||||
"custom_auto_pay_status": "Active" if data.get("custom_auto_pay_enabled") else "Disabled",
|
||||
"custom_auto_pay_status": 1 if data.get("custom_auto_pay_enabled") else 0,
|
||||
"custom_auto_pay_id": data.get("custom_auto_pay_id") if data.get("custom_auto_pay_enabled") else "",
|
||||
"custom_send_via": data.get("custom_send_via"),
|
||||
}).insert(ignore_permissions=True)
|
||||
|
||||
|
||||
contact = frappe.get_doc({
|
||||
"doctype": "Contact",
|
||||
"first_name": data["customer_name"]
|
||||
|
||||
Reference in New Issue
Block a user