From 860bd6953151095abd1ab1651f09c1e2067169eb Mon Sep 17 00:00:00 2001 From: rocketdebris Date: Tue, 10 Feb 2026 19:54:34 -0500 Subject: [PATCH 1/4] Updated ordering of territories to import parents before children. --- custom_ui/fixtures/territory.json | 78 +++++++++++++++---------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/custom_ui/fixtures/territory.json b/custom_ui/fixtures/territory.json index e8c53c9..fae3d6f 100644 --- a/custom_ui/fixtures/territory.json +++ b/custom_ui/fixtures/territory.json @@ -12,6 +12,45 @@ "territory_manager": null, "territory_name": "Rest Of The World" }, + { + "custom_map": null, + "docstatus": 0, + "doctype": "Territory", + "is_group": 1, + "modified": "2024-04-08 03:16:41.446439", + "name": "United States", + "old_parent": "All Territories", + "parent_territory": "All Territories", + "targets": [], + "territory_manager": null, + "territory_name": "United States" + }, + { + "custom_map": null, + "docstatus": 0, + "doctype": "Territory", + "is_group": 1, + "modified": "2024-10-24 16:28:49.004134", + "name": "Idaho", + "old_parent": "United States", + "parent_territory": "United States", + "targets": [], + "territory_manager": null, + "territory_name": "Idaho" + }, + { + "custom_map": null, + "docstatus": 0, + "doctype": "Territory", + "is_group": 1, + "modified": "2024-10-24 16:29:21.492438", + "name": "Washington", + "old_parent": "United States", + "parent_territory": "United States", + "targets": [], + "territory_manager": null, + "territory_name": "Washington" + }, { "custom_map": null, "docstatus": 0, @@ -1246,44 +1285,5 @@ "targets": [], "territory_manager": null, "territory_name": "Hayden Canyon" - }, - { - "custom_map": null, - "docstatus": 0, - "doctype": "Territory", - "is_group": 1, - "modified": "2024-10-24 16:29:21.492438", - "name": "Washington", - "old_parent": "United States", - "parent_territory": "United States", - "targets": [], - "territory_manager": null, - "territory_name": "Washington" - }, - { - "custom_map": null, - "docstatus": 0, - "doctype": "Territory", - "is_group": 1, - "modified": "2024-04-08 03:16:41.446439", - "name": "United States", - "old_parent": "All Territories", - "parent_territory": "All Territories", - "targets": [], - "territory_manager": null, - "territory_name": "United States" - }, - { - "custom_map": null, - "docstatus": 0, - "doctype": "Territory", - "is_group": 1, - "modified": "2024-10-24 16:28:49.004134", - "name": "Idaho", - "old_parent": "United States", - "parent_territory": "United States", - "targets": [], - "territory_manager": null, - "territory_name": "Idaho" } ] \ No newline at end of file From c5e4f3f72a22382f61c67039bc222a6ed3e13845 Mon Sep 17 00:00:00 2001 From: rocketdebris Date: Tue, 10 Feb 2026 19:55:52 -0500 Subject: [PATCH 2/4] Set billing address to correct field in upsert_estimate. --- custom_ui/api/db/estimates.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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), From b0deab7662eefe9f93836d838a52cc91c36e35a2 Mon Sep 17 00:00:00 2001 From: rocketdebris Date: Tue, 10 Feb 2026 19:56:41 -0500 Subject: [PATCH 3/4] Lots of missing fields/tweaks to custom fields. --- custom_ui/custom_fields.py | 72 ++++++++++++++++++++++++++++---------- 1 file changed, 54 insertions(+), 18 deletions(-) diff --git a/custom_ui/custom_fields.py b/custom_ui/custom_fields.py index 2074d1f..a65c9f3 100644 --- a/custom_ui/custom_fields.py +++ b/custom_ui/custom_fields.py @@ -382,6 +382,12 @@ custom_fields = { ) ], "Quotation": [ + dict( + fieldname="custom_installation_address", + label="Installation Address", + fieldtype="Link", + options="Address" + ), dict( fieldname="requires_half_payment", label="Requires Half Payment", @@ -389,20 +395,12 @@ custom_fields = { default=0, insert_after="custom_installation_address" ), - dict( - fieldname="custom_quotation_template", - label="Quotation Template", - fieldtype="Link", - options="Quotation Template", - insert_after="company", - description="The template used for generating this quotation." - ), dict( fieldname="custom_project_template", label="Project Template", fieldtype="Link", options="Project Template", - insert_after="custom_quotation_template", + insert_after="requires_half_payment", description="The project template to use when creating a project from this quotation.", allow_on_submit=1 ), @@ -422,13 +420,6 @@ custom_fields = { options="On-Site Meeting", insert_after="custom_job_address" ), - dict( - fieldname="from_onsite_meeting", - label="From On-Site Meeting", - fieldtype="Link", - options="On-Site Meeting", - insert_after="custom_job_address" - ), dict( fieldname="actual_customer_name", label="Customer", @@ -444,9 +435,39 @@ custom_fields = { options="Customer\nLead", insert_after="customer_name", allow_on_submit=1 - ) + ), + dict( + fieldname="custom_current_status", + label="Status", + fieldtype="Select", + options="Draft\nSubmitted\nEstimate Accepted\nLost\nWon", + insert_after="Date", + allow_on_submit=1 + ), + dict( + fieldname="custom_sent", + label="Sent", + fieldtype="Check", + insert_after="custom_current_status", + default=0, + allow_on_submit=1 + ), + dict( + fieldname="custom_followup_needed", + label="Follow-up Needed", + fieldtype="Check", + insert_after="custom_sent", + default=0, + allow_on_submit=1 + ), ], "Sales Order": [ + dict( + fieldname="custom_installation_address", + label="Installation Address", + fieldtype="Link", + options="Address" + ), dict( fieldname="requires_half_payment", label="Requires Half Payment", @@ -471,7 +492,14 @@ custom_fields = { insert_after="custom_installation_address", description="The address where the job will be performed.", allow_on_submit=1 - ) + ), + dict( + fieldname="custom_department_type", + label="Department Type", + fieldtype="Select", + options="\nFencing Install\nWarranty\nSprinkler Service\nLandscape Installation\nLawn Maintenance", + insert_after="delivery_date", + ), ], "Project": [ dict( @@ -581,5 +609,13 @@ custom_fields = { options="Project Template", insert_after="project" ) + ], + "Territory": [ + dict( + fieldname="custom_map", + label="Map", + fieldtype="Attach Image", + insert_after="is_group" + ) ] } From 0c900618b81f3c244580b620e3929a9d591992df Mon Sep 17 00:00:00 2001 From: rocketdebris Date: Tue, 10 Feb 2026 19:57:20 -0500 Subject: [PATCH 4/4] Disabled a client script breaking things by setting dates in the past. --- custom_ui/fixtures/client_script.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_ui/fixtures/client_script.json b/custom_ui/fixtures/client_script.json index 5889b05..9eab6a5 100644 --- a/custom_ui/fixtures/client_script.json +++ b/custom_ui/fixtures/client_script.json @@ -69,7 +69,7 @@ "docstatus": 0, "doctype": "Client Script", "dt": "Quotation", - "enabled": 1, + "enabled": 0, "modified": "2025-01-08 05:04:26.743210", "module": null, "name": "Quotation - Set Same Valid Until Date",