merge main
This commit is contained in:
parent
f7ce3a39d0
commit
4c8e66d155
9 changed files with 349 additions and 206 deletions
|
|
@ -1,3 +1,4 @@
|
|||
from curses import meta
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
|
@ -23,14 +24,14 @@ def after_migrate():
|
|||
update_onsite_meeting_fields()
|
||||
frappe.db.commit()
|
||||
|
||||
# Proper way to refresh metadata
|
||||
frappe.clear_cache(doctype="Address")
|
||||
frappe.reload_doctype("Address")
|
||||
frappe.clear_cache(doctype="On-Site Meeting")
|
||||
frappe.reload_doctype("On-Site Meeting")
|
||||
# Proper way to refresh metadata for all doctypes with custom fields
|
||||
doctypes_to_refresh = ["Lead", "Address", "Contact", "On-Site Meeting", "Quotation", "Sales Order", "Project Template"]
|
||||
for doctype in doctypes_to_refresh:
|
||||
frappe.clear_cache(doctype=doctype)
|
||||
frappe.reload_doctype(doctype)
|
||||
|
||||
# update_address_fields()
|
||||
build_frontend()
|
||||
update_address_fields()
|
||||
# build_frontend()
|
||||
|
||||
|
||||
def build_frontend():
|
||||
|
|
@ -68,7 +69,7 @@ def build_frontend():
|
|||
def add_custom_fields():
|
||||
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
|
||||
|
||||
print("\n🔧 Adding custom fields to Address doctype...")
|
||||
print("\n🔧 Adding custom fields to doctypes...")
|
||||
|
||||
custom_fields = {
|
||||
"Lead": [
|
||||
|
|
@ -208,7 +209,17 @@ def add_custom_fields():
|
|||
fieldtype="Link",
|
||||
options="Project Template",
|
||||
insert_after="custom_quotation_template",
|
||||
description="The project template to use when creating a project from this quotation."
|
||||
description="The project template to use when creating a project from this quotation.",
|
||||
allow_on_submit=1
|
||||
),
|
||||
dict(
|
||||
fieldname="custom_job_address",
|
||||
label="Job Address",
|
||||
fieldtype="Link",
|
||||
options="Address",
|
||||
insert_after="custom_installation_address",
|
||||
description="The address where the job will be performed.",
|
||||
allow_on_submit=1
|
||||
)
|
||||
],
|
||||
"Sales Order": [
|
||||
|
|
@ -225,7 +236,17 @@ def add_custom_fields():
|
|||
fieldtype="Link",
|
||||
options="Project Template",
|
||||
description="The project template to use when creating a project from this sales order.",
|
||||
insert_after="custom_installation_address"
|
||||
insert_after="custom_installation_address",
|
||||
allow_on_submit=1
|
||||
),
|
||||
dict(
|
||||
fieldname="custom_job_address",
|
||||
label="Job Address",
|
||||
fieldtype="Link",
|
||||
options="Address",
|
||||
insert_after="custom_installation_address",
|
||||
description="The address where the job will be performed.",
|
||||
allow_on_submit=1
|
||||
)
|
||||
],
|
||||
"Project Template": [
|
||||
|
|
@ -240,32 +261,68 @@ def add_custom_fields():
|
|||
]
|
||||
}
|
||||
|
||||
lead_field_count = len(custom_fields["Lead"])
|
||||
address_field_count = len(custom_fields["Address"])
|
||||
contact_field_count = len(custom_fields["Contact"])
|
||||
onsite_field_count = len(custom_fields["On-Site Meeting"])
|
||||
quotation_field_count = len(custom_fields["Quotation"])
|
||||
sales_order_field_count = len(custom_fields["Sales Order"])
|
||||
project_template_field_count = len(custom_fields["Project Template"])
|
||||
field_count = (lead_field_count + address_field_count + contact_field_count +
|
||||
onsite_field_count + quotation_field_count +
|
||||
sales_order_field_count + project_template_field_count)
|
||||
print(f"🔧 Preparing to add {field_count} custom fields:")
|
||||
print(f" • Lead: {lead_field_count} fields")
|
||||
print(f" • Address: {address_field_count} fields")
|
||||
print(f" • Contact: {contact_field_count} fields")
|
||||
print(f" • On-Site Meeting: {onsite_field_count} fields")
|
||||
print(f" • Quotation: {quotation_field_count} fields")
|
||||
print(f" • Sales Order: {sales_order_field_count} fields")
|
||||
print(f" • Project Template: {project_template_field_count} fields")
|
||||
print("🔧 Custom fields to check per doctype:")
|
||||
for key, value in custom_fields.items():
|
||||
print(f" • {key}: {len(value)} fields")
|
||||
print(f" Total fields to check: {sum(len(v) for v in custom_fields.values())}\n")
|
||||
|
||||
missing_fields = []
|
||||
fields_to_update = []
|
||||
|
||||
for doctype, field_options in custom_fields.items():
|
||||
meta = frappe.get_meta(doctype)
|
||||
for field_spec in field_options:
|
||||
fieldname = field_spec["fieldname"]
|
||||
if not meta.has_field(fieldname):
|
||||
missing_fields.append(f"{doctype}: {fieldname}")
|
||||
else:
|
||||
# Field exists, check if specs match
|
||||
custom_field_name = f"{doctype}-{fieldname}"
|
||||
if frappe.db.exists("Custom Field", custom_field_name):
|
||||
custom_field_doc = frappe.get_doc("Custom Field", custom_field_name)
|
||||
needs_update = False
|
||||
|
||||
# Compare important properties
|
||||
for key, desired_value in field_spec.items():
|
||||
if key == "fieldname":
|
||||
continue
|
||||
current_value = getattr(custom_field_doc, key, None)
|
||||
if current_value != desired_value:
|
||||
needs_update = True
|
||||
break
|
||||
|
||||
if needs_update:
|
||||
fields_to_update.append((doctype, fieldname, field_spec))
|
||||
|
||||
if missing_fields:
|
||||
print("\n❌ Missing custom fields:")
|
||||
for entry in missing_fields:
|
||||
print(f" • {entry}")
|
||||
print("\n🔧 Creating missing custom fields...")
|
||||
missing_field_specs = build_missing_field_specs(custom_fields, missing_fields)
|
||||
create_custom_fields(missing_field_specs)
|
||||
print("✅ Missing custom fields created.")
|
||||
|
||||
if fields_to_update:
|
||||
print("\n🔧 Updating custom fields with mismatched specs:")
|
||||
for doctype, fieldname, field_spec in fields_to_update:
|
||||
print(f" • {doctype}: {fieldname}")
|
||||
custom_field_name = f"{doctype}-{fieldname}"
|
||||
custom_field_doc = frappe.get_doc("Custom Field", custom_field_name)
|
||||
|
||||
# Update all properties from field_spec
|
||||
for key, value in field_spec.items():
|
||||
if key != "fieldname":
|
||||
setattr(custom_field_doc, key, value)
|
||||
|
||||
custom_field_doc.save(ignore_permissions=True)
|
||||
|
||||
frappe.db.commit()
|
||||
print("✅ Custom fields updated.")
|
||||
|
||||
if not missing_fields and not fields_to_update:
|
||||
print("✅ All custom fields verified.")
|
||||
|
||||
try:
|
||||
create_custom_fields(custom_fields)
|
||||
print("✅ Custom fields added successfully!")
|
||||
except Exception as e:
|
||||
print(f"❌ Error creating custom fields: {str(e)}")
|
||||
frappe.log_error(message=str(e), title="Custom Fields Creation Failed")
|
||||
raise
|
||||
|
||||
def update_onsite_meeting_fields():
|
||||
"""Update On-Site Meeting doctype fields to make start_time and end_time optional."""
|
||||
|
|
@ -297,90 +354,55 @@ def update_onsite_meeting_fields():
|
|||
# Don't raise - this is not critical enough to stop migration
|
||||
|
||||
def update_address_fields():
|
||||
quotations = frappe.get_all("Quotation", pluck="name")
|
||||
addresses = frappe.get_all("Address", pluck="name")
|
||||
sales_orders = frappe.get_all("Sales Order", pluck="name")
|
||||
total_addresses = len(addresses)
|
||||
total_quotations = len(quotations)
|
||||
total_sales_orders = len(sales_orders)
|
||||
total_doctypes = total_addresses + total_quotations + total_sales_orders
|
||||
combined_doctypes = []
|
||||
for sales_order in sales_orders:
|
||||
combined_doctypes.append({"doctype": "Sales Order", "name": sales_order})
|
||||
for quotation in quotations:
|
||||
combined_doctypes.append({"doctype": "Quotation", "name": quotation})
|
||||
for address in addresses:
|
||||
combined_doctypes.append({"doctype": "Address", "name": address})
|
||||
|
||||
|
||||
if total_addresses == 0:
|
||||
print("📍 No addresses found to update.")
|
||||
return
|
||||
|
||||
print(f"\n📍 Updating fields for {total_addresses} addresses...")
|
||||
|
||||
# Verify custom fields exist by checking the meta for every doctype that was customized
|
||||
def has_any_field(meta, candidates):
|
||||
return any(meta.has_field(f) for f in candidates)
|
||||
|
||||
custom_field_expectations = {
|
||||
"Address": [
|
||||
["full_address"],
|
||||
["custom_onsite_meeting_scheduled", "onsite_meeting_scheduled"],
|
||||
["custom_estimate_sent_status", "estimate_sent_status"],
|
||||
["custom_job_status", "job_status"],
|
||||
["custom_payment_received_status", "payment_received_status",],
|
||||
["custom_lead_name", "lead_name"]
|
||||
],
|
||||
"Contact": [
|
||||
["custom_role", "role"],
|
||||
["custom_email", "email"],
|
||||
],
|
||||
"On-Site Meeting": [
|
||||
["custom_notes", "notes"],
|
||||
["custom_assigned_employee", "assigned_employee"],
|
||||
["custom_status", "status"],
|
||||
["custom_completed_by", "completed_by"]
|
||||
],
|
||||
"Quotation": [
|
||||
["custom_requires_half_payment", "requires_half_payment"]
|
||||
],
|
||||
"Sales Order": [
|
||||
["custom_requires_half_payment", "requires_half_payment"]
|
||||
],
|
||||
"Lead": [
|
||||
["custom_customer_type", "customer_type"]
|
||||
]
|
||||
}
|
||||
|
||||
missing_fields = []
|
||||
for doctype, field_options in custom_field_expectations.items():
|
||||
meta = frappe.get_meta(doctype)
|
||||
for candidates in field_options:
|
||||
if not has_any_field(meta, candidates):
|
||||
missing_fields.append(f"{doctype}: {'/'.join(candidates)}")
|
||||
|
||||
if missing_fields:
|
||||
print("\n❌ Missing custom fields:")
|
||||
for entry in missing_fields:
|
||||
print(f" • {entry}")
|
||||
print(" Custom fields creation may have failed. Skipping address updates.")
|
||||
return
|
||||
|
||||
print("✅ All custom fields verified. Proceeding with address updates...")
|
||||
print(f"\n📍 Updating field values for {total_addresses} addresses, {total_quotations} quotations, and {total_sales_orders} sales orders...")
|
||||
|
||||
# Field update counters
|
||||
field_counters = {
|
||||
'quotation_addresses_updated': 0,
|
||||
'quotation_project_templates_updated': 0,
|
||||
'sales_order_addresses_updated': 0,
|
||||
'sales_order_project_templates_updated': 0,
|
||||
'full_address': 0,
|
||||
'custom_onsite_meeting_scheduled': 0,
|
||||
'custom_estimate_sent_status': 0,
|
||||
'custom_job_status': 0,
|
||||
'custom_payment_received_status': 0
|
||||
'custom_payment_received_status': 0,
|
||||
'total_field_updates': 0,
|
||||
'addresses_updated': 0,
|
||||
'quotations_updated': 0,
|
||||
'sales_orders_updated': 0
|
||||
}
|
||||
total_field_updates = 0
|
||||
addresses_updated = 0
|
||||
|
||||
onsite_meta = frappe.get_meta("On-Site Meeting")
|
||||
onsite_status_field = "custom_status" if onsite_meta.has_field("custom_status") else "status"
|
||||
|
||||
for index, name in enumerate(addresses, 1):
|
||||
for index, doc in enumerate(combined_doctypes, 1):
|
||||
# Calculate progress
|
||||
progress_percentage = int((index / total_addresses) * 100)
|
||||
progress_percentage = int((index / total_doctypes) * 100)
|
||||
bar_length = 30
|
||||
filled_length = int(bar_length * index // total_addresses)
|
||||
filled_length = int(bar_length * index // total_doctypes)
|
||||
bar = '█' * filled_length + '░' * (bar_length - filled_length)
|
||||
|
||||
# Print a three-line, refreshing progress block without adding new lines each loop
|
||||
progress_line = f"📊 Progress: [{bar}] {progress_percentage:3d}% ({index}/{total_addresses})"
|
||||
counters_line = f" Fields updated: {total_field_updates} | Addresses updated: {addresses_updated}"
|
||||
detail_line = f" Processing: {name[:40]}..."
|
||||
progress_line = f"📊 Progress: [{bar}] {progress_percentage:3d}% ({index}/{total_doctypes})"
|
||||
counters_line = f" Fields updated: {field_counters['total_field_updates']} | DocTypes updated: {field_counters['addresses_updated'] + field_counters['quotations_updated'] + field_counters['sales_orders_updated']}"
|
||||
detail_line = f" Processing: {doc['name'][:40]}..."
|
||||
|
||||
if index == 1:
|
||||
# First render: write the three lines
|
||||
|
|
@ -396,100 +418,139 @@ def update_address_fields():
|
|||
sys.stdout.write(f"\033[K{counters_line}\n")
|
||||
sys.stdout.write(f"\033[K{detail_line}")
|
||||
|
||||
if index == total_addresses:
|
||||
if index == total_doctypes:
|
||||
sys.stdout.write("\n")
|
||||
|
||||
sys.stdout.flush()
|
||||
|
||||
should_update = False
|
||||
address = frappe.get_doc("Address", name)
|
||||
current_address_updates = 0
|
||||
|
||||
# Use getattr with default values instead of direct attribute access
|
||||
if not getattr(address, 'full_address', None):
|
||||
address_parts_1 = [
|
||||
address.address_line1 or "",
|
||||
address.address_line2 or "",
|
||||
address.city or "",
|
||||
]
|
||||
address_parts_2 = [
|
||||
address.state or "",
|
||||
address.pincode or "",
|
||||
]
|
||||
if doc['doctype'] == "Quotation" or doc['doctype'] == "Sales Order":
|
||||
dict_field = doc['doctype'].lower().replace(" ", "_")
|
||||
quotation_doc = frappe.get_doc(doc['doctype'], doc['name'])
|
||||
custom_installation_address = getattr(quotation_doc, 'custom_installation_address', None)
|
||||
custom_job_address = getattr(quotation_doc, 'custom_job_address', None)
|
||||
custom_project_template = getattr(quotation_doc, 'custom_project_template', None)
|
||||
|
||||
full_address = ", ".join([
|
||||
" ".join(filter(None, address_parts_1)),
|
||||
" ".join(filter(None, address_parts_2))
|
||||
]).strip()
|
||||
address.full_address = full_address
|
||||
field_counters['full_address'] += 1
|
||||
current_address_updates += 1
|
||||
should_update = True
|
||||
onsite_meeting = "Not Started"
|
||||
estimate_sent = "Not Started"
|
||||
job_status = "Not Started"
|
||||
payment_received = "Not Started"
|
||||
|
||||
onsite_meetings = frappe.get_all("On-Site Meeting", fields=[onsite_status_field], filters={"address": address.address_title})
|
||||
if onsite_meetings and onsite_meetings[0]:
|
||||
status_value = onsite_meetings[0].get(onsite_status_field)
|
||||
onsite_meeting = "Completed" if status_value == "Completed" else "In Progress"
|
||||
|
||||
estimates = frappe.get_all("Quotation", fields=["custom_sent", "docstatus", "custom_response"], filters={"custom_installation_address": address.address_title})
|
||||
if estimates and estimates[0] and estimates[0]["custom_sent"] == 1 and estimates[0]["custom_response"]:
|
||||
estimate_sent = "Completed"
|
||||
elif estimates and estimates[0] and not (estimates[0]["custom_sent"] == 1 and estimates[0]["custom_response"]):
|
||||
estimate_sent = "In Progress"
|
||||
updates = {}
|
||||
if custom_installation_address and not custom_job_address:
|
||||
updates['custom_job_address'] = custom_installation_address
|
||||
field_counters[f"{dict_field}_addresses_updated"] += 1
|
||||
field_counters['total_field_updates'] += 1
|
||||
if custom_installation_address and not custom_project_template:
|
||||
updates['custom_project_template'] = "SNW Install"
|
||||
field_counters[f"{dict_field}_project_templates_updated"] += 1
|
||||
field_counters['total_field_updates'] += 1
|
||||
|
||||
jobs = frappe.get_all("Project", fields=["status"], filters={"custom_installation_address": address.address_title, "project_template": "SNW Install"})
|
||||
if jobs and jobs[0] and jobs[0]["status"] == "Completed":
|
||||
job_status = "Completed"
|
||||
elif jobs and jobs[0]:
|
||||
job_status = "In Progress"
|
||||
|
||||
sales_invoices = frappe.get_all("Sales Invoice", fields=["outstanding_amount"], filters={"custom_installation_address": address.address_title})
|
||||
# payments = frappe.get_all("Payment Entry", filters={"custom_installation_address": address.address_title})
|
||||
if sales_invoices and sales_invoices[0] and sales_invoices[0]["outstanding_amount"] == 0:
|
||||
payment_received = "Completed"
|
||||
elif sales_invoices and sales_invoices[0]:
|
||||
payment_received = "In Progress"
|
||||
|
||||
if getattr(address, 'custom_onsite_meeting_scheduled', None) != onsite_meeting:
|
||||
address.custom_onsite_meeting_scheduled = onsite_meeting
|
||||
field_counters['custom_onsite_meeting_scheduled'] += 1
|
||||
current_address_updates += 1
|
||||
should_update = True
|
||||
if getattr(address, 'custom_estimate_sent_status', None) != estimate_sent:
|
||||
address.custom_estimate_sent_status = estimate_sent
|
||||
field_counters['custom_estimate_sent_status'] += 1
|
||||
current_address_updates += 1
|
||||
should_update = True
|
||||
if getattr(address, 'custom_job_status', None) != job_status:
|
||||
address.custom_job_status = job_status
|
||||
field_counters['custom_job_status'] += 1
|
||||
current_address_updates += 1
|
||||
should_update = True
|
||||
if getattr(address, 'custom_payment_received_status', None) != payment_received:
|
||||
address.custom_payment_received_status = payment_received
|
||||
field_counters['custom_payment_received_status'] += 1
|
||||
current_address_updates += 1
|
||||
should_update = True
|
||||
if updates:
|
||||
frappe.db.set_value(doc['doctype'], doc['name'], updates)
|
||||
field_counters[f"{dict_field}s_updated"] += 1
|
||||
|
||||
if doc['doctype'] == "Address":
|
||||
address_doc = frappe.get_doc("Address", doc['name'])
|
||||
updates = {}
|
||||
|
||||
if should_update:
|
||||
address.save(ignore_permissions=True)
|
||||
addresses_updated += 1
|
||||
total_field_updates += current_address_updates
|
||||
# Use getattr with default values instead of direct attribute access
|
||||
if not getattr(address_doc, 'full_address', None):
|
||||
address_parts_1 = [
|
||||
address_doc.address_line1 or "",
|
||||
address_doc.address_line2 or "",
|
||||
address_doc.city or "",
|
||||
]
|
||||
address_parts_2 = [
|
||||
address_doc.state or "",
|
||||
address_doc.pincode or "",
|
||||
]
|
||||
|
||||
full_address = ", ".join([
|
||||
" ".join(filter(None, address_parts_1)),
|
||||
" ".join(filter(None, address_parts_2))
|
||||
]).strip()
|
||||
updates['full_address'] = full_address
|
||||
field_counters['full_address'] += 1
|
||||
field_counters['total_field_updates'] += 1
|
||||
|
||||
onsite_meeting = "Not Started"
|
||||
estimate_sent = "Not Started"
|
||||
job_status = "Not Started"
|
||||
payment_received = "Not Started"
|
||||
|
||||
|
||||
onsite_meetings = frappe.get_all("On-Site Meeting", fields=[onsite_status_field], filters={"address": address_doc.address_title})
|
||||
if onsite_meetings and onsite_meetings[0]:
|
||||
status_value = onsite_meetings[0].get(onsite_status_field)
|
||||
onsite_meeting = "Completed" if status_value == "Completed" else "In Progress"
|
||||
|
||||
estimates = frappe.get_all("Quotation", fields=["custom_sent", "docstatus", "custom_response"], filters={"custom_job_address": address_doc.address_title})
|
||||
if estimates and estimates[0] and estimates[0]["custom_sent"] == 1 and estimates[0]["custom_response"]:
|
||||
estimate_sent = "Completed"
|
||||
elif estimates and estimates[0] and not (estimates[0]["custom_sent"] == 1 and estimates[0]["custom_response"]):
|
||||
estimate_sent = "In Progress"
|
||||
|
||||
jobs = frappe.get_all("Project", fields=["status"], filters={"custom_installation_address": address_doc.address_title, "project_template": "SNW Install"})
|
||||
if jobs and jobs[0] and jobs[0]["status"] == "Completed":
|
||||
job_status = "Completed"
|
||||
elif jobs and jobs[0]:
|
||||
job_status = "In Progress"
|
||||
|
||||
sales_invoices = frappe.get_all("Sales Invoice", fields=["outstanding_amount"], filters={"custom_installation_address": address_doc.address_title})
|
||||
# payments = frappe.get_all("Payment Entry", filters={"custom_installation_address": address_doc.address_title})
|
||||
if sales_invoices and sales_invoices[0] and sales_invoices[0]["outstanding_amount"] == 0:
|
||||
payment_received = "Completed"
|
||||
elif sales_invoices and sales_invoices[0]:
|
||||
payment_received = "In Progress"
|
||||
|
||||
if getattr(address_doc, 'custom_onsite_meeting_scheduled', None) != onsite_meeting:
|
||||
updates['custom_onsite_meeting_scheduled'] = onsite_meeting
|
||||
field_counters['custom_onsite_meeting_scheduled'] += 1
|
||||
field_counters['total_field_updates'] += 1
|
||||
if getattr(address_doc, 'custom_estimate_sent_status', None) != estimate_sent:
|
||||
updates['custom_estimate_sent_status'] = estimate_sent
|
||||
field_counters['custom_estimate_sent_status'] += 1
|
||||
field_counters['total_field_updates'] += 1
|
||||
if getattr(address_doc, 'custom_job_status', None) != job_status:
|
||||
updates['custom_job_status'] = job_status
|
||||
field_counters['custom_job_status'] += 1
|
||||
field_counters['total_field_updates'] += 1
|
||||
if getattr(address_doc, 'custom_payment_received_status', None) != payment_received:
|
||||
updates['custom_payment_received_status'] = payment_received
|
||||
field_counters['custom_payment_received_status'] += 1
|
||||
field_counters['total_field_updates'] += 1
|
||||
|
||||
if updates:
|
||||
frappe.db.set_value("Address", doc['name'], updates)
|
||||
field_counters['addresses_updated'] += 1
|
||||
|
||||
# Commit every 100 records to avoid long transactions
|
||||
if index % 100 == 0:
|
||||
frappe.db.commit()
|
||||
|
||||
# Print completion summary
|
||||
print(f"\n\n✅ Address field update completed!")
|
||||
print(f"\n\n✅ DocType field value update completed!")
|
||||
print(f"📊 Summary:")
|
||||
print(f" • Total addresses processed: {total_addresses:,}")
|
||||
print(f" • Addresses updated: {addresses_updated:,}")
|
||||
print(f" • Total field updates: {total_field_updates:,}")
|
||||
print(f" • Total DocTypes processed: {total_doctypes:,}")
|
||||
print(f" • Addresses updated: {field_counters['addresses_updated']:,}")
|
||||
print(f" • Quotations updated: {field_counters['quotations_updated']:,}")
|
||||
print(f" • Sales Orders updated: {field_counters['sales_orders_updated']:,}")
|
||||
print(f" • Total field updates: {field_counters['total_field_updates']:,}")
|
||||
print(f"\n📝 Field-specific updates:")
|
||||
print(f" • Full Address: {field_counters['full_address']:,}")
|
||||
print(f" • On-Site Meeting Status: {field_counters['custom_onsite_meeting_scheduled']:,}")
|
||||
print(f" • Estimate Sent Status: {field_counters['custom_estimate_sent_status']:,}")
|
||||
print(f" • Job Status: {field_counters['custom_job_status']:,}")
|
||||
print(f" • Payment Received Status: {field_counters['custom_payment_received_status']:,}")
|
||||
print("📍 Address field updates complete.\n")
|
||||
print(f" • Quotation Addresses Updated: {field_counters['quotation_addresses_updated']:,}")
|
||||
print(f" • Quotation Project Templates Updated: {field_counters['quotation_project_templates_updated']:,}")
|
||||
print(f" • Sales Order Addresses Updated: {field_counters['sales_order_addresses_updated']:,}")
|
||||
print(f" • Sales Order Project Templates Updated: {field_counters['sales_order_project_templates_updated']:,}")
|
||||
print("📍 DocType field value updates complete.\n")
|
||||
|
||||
def build_missing_field_specs(custom_fields, missing_fields):
|
||||
missing_field_specs = {}
|
||||
for entry in missing_fields:
|
||||
doctype, fieldname = entry.split(": ")
|
||||
missing_field_specs.setdefault(doctype, [])
|
||||
for field_spec in custom_fields.get(doctype, []):
|
||||
if field_spec["fieldname"] == fieldname:
|
||||
missing_field_specs[doctype].append(field_spec)
|
||||
break
|
||||
|
||||
return missing_field_specs
|
||||
Loading…
Add table
Add a link
Reference in a new issue