estimate view
This commit is contained in:
parent
7c738ef9f9
commit
0663cd2d8c
4 changed files with 116 additions and 23 deletions
|
|
@ -32,9 +32,10 @@ def get_estimate_table_data(filters={}, sortings=[], page=1, page_size=10):
|
|||
|
||||
tableRows = []
|
||||
for estimate in estimates:
|
||||
full_address = frappe.db.get_value("Address", estimate.get("custom_installation_address"), "full_address")
|
||||
tableRow = {}
|
||||
tableRow["id"] = estimate["name"]
|
||||
tableRow["name"] = estimate["name"]
|
||||
tableRow["address"] = full_address
|
||||
tableRow["quotation_to"] = estimate.get("quotation_to", "")
|
||||
tableRow["customer"] = estimate.get("party_name", "")
|
||||
tableRow["status"] = estimate.get("custom_current_status", "")
|
||||
|
|
@ -78,17 +79,21 @@ def get_estimate_items():
|
|||
|
||||
@frappe.whitelist()
|
||||
def get_estimate_from_address(full_address):
|
||||
quotation = frappe.db.sql("""
|
||||
SELECT q.name, q.custom_installation_address
|
||||
FROM `tabQuotation` q
|
||||
JOIN `tabAddress` a
|
||||
ON q.custom_installation_address = a.name
|
||||
WHERE a.full_address =%s
|
||||
""", (full_address,), as_dict=True)
|
||||
if quotation:
|
||||
return build_success_response(quotation)
|
||||
else:
|
||||
return build_error_response("No quotation found for the given address.", 404)
|
||||
address_name = frappe.db.get_value("Address", {"full_address": full_address}, "name")
|
||||
quotation_name = frappe.db.get_value("Quotation", {"custom_installation_address": address_name}, "name")
|
||||
quotation_doc = frappe.get_doc("Quotation", quotation_name)
|
||||
return build_success_response(quotation_doc.as_dict())
|
||||
# quotation = frappe.db.sql("""
|
||||
# SELECT q.name, q.custom_installation_address
|
||||
# FROM `tabQuotation` q
|
||||
# JOIN `tabAddress` a
|
||||
# ON q.custom_installation_address = a.name
|
||||
# WHERE a.full_address =%s
|
||||
# """, (full_address,), as_dict=True)
|
||||
# if quotation:
|
||||
# return build_success_response(quotation)
|
||||
# else:
|
||||
# return build_error_response("No quotation found for the given address.", 404)
|
||||
|
||||
@frappe.whitelist()
|
||||
def upsert_estimate(data):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue