diff --git a/custom_ui/api/db/estimates.py b/custom_ui/api/db/estimates.py index 86c1d2e..5e0ba07 100644 --- a/custom_ui/api/db/estimates.py +++ b/custom_ui/api/db/estimates.py @@ -26,7 +26,7 @@ def get_estimate_table_data_v2(filters={}, sortings=[], page=1, page_size=10): start=(page) * page_size, order_by=sortings ) - + estimates = [frappe.get_doc("Quotation", name).as_dict() for name in estimate_names] tableRows = [] for estimate in estimates: @@ -41,7 +41,7 @@ def get_estimate_table_data_v2(filters={}, sortings=[], page=1, page_size=10): tableRows.append(tableRow) table_data_dict = build_datatable_dict(data=tableRows, count=count, page=page, page_size=page_size) return build_success_response(table_data_dict) - + @frappe.whitelist() def get_estimate_table_data(filters={}, sortings=[], page=1, page_size=10): @@ -283,14 +283,14 @@ def send_estimate_email(estimate_name): attachments=[{"fname": f"{quotation.name}.pdf", "fcontent": pdf}] ) print(f"DEBUG: Email sent to {email} successfully.") - + # Update quotation status quotation.custom_current_status = "Submitted" quotation.custom_sent = 1 quotation.save() quotation.submit() frappe.db.commit() - + updated_quotation = frappe.get_doc("Quotation", estimate_name) return build_success_response(updated_quotation.as_dict()) except Exception as e: @@ -510,7 +510,7 @@ def upsert_estimate(data): "company": data.get("company"), "actual_customer_name": client_doc.name, "customer_type": address_doc.customer_type, - "customer_address": client_doc.custom_billing_address, + "customer_address": client_doc.primary_address, "contact_person": data.get("contact_name"), "letter_head": data.get("company"), "custom_project_template": data.get("project_template", None),