Further merge conflicts.
This commit is contained in:
parent
3fa8b1ce99
commit
2ac06d8532
@ -203,10 +203,6 @@ def get_clients_table_data(filters={}, sortings=[], page=1, page_size=10):
|
|||||||
def upsert_client(data):
|
def upsert_client(data):
|
||||||
"""Create or update a client (customer and address)."""
|
"""Create or update a client (customer and address)."""
|
||||||
try:
|
try:
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
|
|
||||||
>>>>>>> 8f44d90 (Fixed an API error when searching for a non existent client name.)
|
|
||||||
data = json.loads(data)
|
data = json.loads(data)
|
||||||
|
|
||||||
# Handle customer creation/update
|
# Handle customer creation/update
|
||||||
@ -221,7 +217,6 @@ def upsert_client(data):
|
|||||||
}).insert(ignore_permissions=True)
|
}).insert(ignore_permissions=True)
|
||||||
else:
|
else:
|
||||||
customer_doc = frappe.get_doc("Customer", data.get("customer_name"))
|
customer_doc = frappe.get_doc("Customer", data.get("customer_name"))
|
||||||
<<<<<<< HEAD
|
|
||||||
print("Customer:", customer_doc.as_dict())
|
print("Customer:", customer_doc.as_dict())
|
||||||
|
|
||||||
# Handle address creation
|
# Handle address creation
|
||||||
@ -236,23 +231,7 @@ def upsert_client(data):
|
|||||||
print("Existing address check:", existing_address)
|
print("Existing address check:", existing_address)
|
||||||
if existing_address:
|
if existing_address:
|
||||||
frappe.throw(f"Address already exists for customer {data.get('customer_name')}.", frappe.ValidationError)
|
frappe.throw(f"Address already exists for customer {data.get('customer_name')}.", frappe.ValidationError)
|
||||||
=======
|
|
||||||
|
|
||||||
print("Customer:", customer_doc.as_dict())
|
|
||||||
|
|
||||||
# Check for existing address
|
|
||||||
filters = {
|
|
||||||
"address_line1": data.get("address_line1"),
|
|
||||||
"city": data.get("city"),
|
|
||||||
"state": data.get("state"),
|
|
||||||
}
|
|
||||||
existing_address = frappe.db.exists("Address", filters)
|
|
||||||
print("Existing address check:", existing_address)
|
|
||||||
if existing_address:
|
|
||||||
frappe.throw(f"Address already exists for customer {data.get('customer_name')}.", frappe.ValidationError)
|
|
||||||
|
|
||||||
# Create address
|
|
||||||
>>>>>>> 8f44d90 (Fixed an API error when searching for a non existent client name.)
|
|
||||||
address_doc = frappe.get_doc({
|
address_doc = frappe.get_doc({
|
||||||
"doctype": "Address",
|
"doctype": "Address",
|
||||||
"address_title": data.get("address_title"),
|
"address_title": data.get("address_title"),
|
||||||
@ -264,7 +243,6 @@ def upsert_client(data):
|
|||||||
"pincode": data.get("pincode"),
|
"pincode": data.get("pincode"),
|
||||||
"custom_customer_to_bill": customer_doc.name
|
"custom_customer_to_bill": customer_doc.name
|
||||||
}).insert(ignore_permissions=True)
|
}).insert(ignore_permissions=True)
|
||||||
<<<<<<< HEAD
|
|
||||||
print("Address:", address_doc.as_dict())
|
print("Address:", address_doc.as_dict())
|
||||||
|
|
||||||
#Handle contact creation
|
#Handle contact creation
|
||||||
@ -320,11 +298,6 @@ def upsert_client(data):
|
|||||||
# Address -> Customer
|
# Address -> Customer
|
||||||
print("#####DEBUG: Linking address to customer.")
|
print("#####DEBUG: Linking address to customer.")
|
||||||
address_doc.append("links", {
|
address_doc.append("links", {
|
||||||
=======
|
|
||||||
|
|
||||||
# Link address to customer
|
|
||||||
link = {
|
|
||||||
>>>>>>> 8f44d90 (Fixed an API error when searching for a non existent client name.)
|
|
||||||
"link_doctype": "Customer",
|
"link_doctype": "Customer",
|
||||||
"link_name": customer_doc.name
|
"link_name": customer_doc.name
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user