Compare commits

..

No commits in common. "d53ebf9ecd45371d7287e65b577335eb9fe7986b" and "841d52c61ab0d45453490526b2d99bf2e75d34cb" have entirely different histories.

2 changed files with 20 additions and 2850 deletions

File diff suppressed because it is too large Load diff

View file

@ -30,7 +30,7 @@ def after_migrate():
frappe.clear_cache(doctype=doctype) frappe.clear_cache(doctype=doctype)
frappe.reload_doctype(doctype) frappe.reload_doctype(doctype)
# update_address_fields() update_address_fields()
# build_frontend() # build_frontend()
@ -80,34 +80,6 @@ def add_custom_fields():
options="Customer Company Link", options="Customer Company Link",
insert_after="customer_type" insert_after="customer_type"
), ),
dict(
fieldname="quotations",
label="Quotations",
fieldtype="Table",
options="Customer Quotation Link",
insert_after="companies"
),
dict(
fieldname="onsite_meetings",
label="On-Site Meetings",
fieldtype="Table",
options="Customer On-Site Meeting Link",
insert_after="quotations"
),
dict(
fieldname="projects",
label="Projects",
fieldtype="Table",
options="Customer Project Link",
insert_after="onsite_meetings"
),
dict(
fieldname="sales_orders",
label="Sales Orders",
fieldtype="Table",
options="Customer Sales Order Link",
insert_after="projects"
),
dict( dict(
fieldname="from_lead", fieldname="from_lead",
label="From Lead", label="From Lead",
@ -128,102 +100,18 @@ def add_custom_fields():
fieldtype="Table", fieldtype="Table",
options="Customer Contact Link", options="Customer Contact Link",
insert_after="properties" insert_after="properties"
),
dict(
fieldname="primary_contact",
label="Primary Contact",
fieldtype="Link",
options="Contact",
insert_after="contacts"
) )
], ],
"Lead": [ "Lead": [
dict(
fieldname="onsite_meetings",
label="On-Site Meetings",
fieldtype="Table",
options="Lead On-Site Meeting Link",
insert_after="quotations"
),
dict(
fieldname="quotations",
label="Quotations",
fieldtype="Table",
options="Lead Quotation Link",
insert_after="companies"
),
dict(
fieldname="companies",
label="Companies",
fieldtype="Table",
options="Lead Company Link",
insert_after="customer_type"
),
dict( dict(
fieldname="customer_type", fieldname="customer_type",
label="Customer Type", label="Customer Type",
fieldtype="Select", fieldtype="Select",
options="Individual\nCompany\nPartnership", options="Individual\nCompany\nPartnership",
insert_after="lead_name" insert_after="lead_name"
),
dict(
fieldname="properties",
label="Properties",
fieldtype="Table",
options="Lead Address Link",
insert_after="customer_name"
),
dict(
fieldname="contacts",
label="Contacts",
fieldtype="Table",
options="Lead Contact Link",
insert_after="properties"
),
dict(
fieldname="primary_contact",
label="Primary Contact",
fieldtype="Link",
options="Contact",
insert_after="contacts"
) )
], ],
"Address": [ "Address": [
dict(
fieldname="primary_contact",
label="Primary Contact",
fieldtype="Link",
options="Contact",
insert_after="address_title"
),
dict(
fieldname="projects",
label="Projects",
fieldtype="Table",
options="Address Project Link",
insert_after="onsite_meetings"
),
dict(
fieldname="sales_orders",
label="Sales Orders",
fieldtype="Table",
options="Address Sales Order Link",
insert_after="projects"
),
dict(
fieldname="onsite_meetings",
label="On-Site Meetings",
fieldtype="Table",
options="Address On-Site Meeting Link",
insert_after="quotations"
),
dict(
fieldname="quotations",
label="Quotations",
fieldtype="Table",
options="Address Quotation Link",
insert_after="companies"
),
dict( dict(
fieldname="full_address", fieldname="full_address",
label="Full Address", label="Full Address",
@ -295,20 +183,6 @@ def add_custom_fields():
fieldtype="Dynamic Link", fieldtype="Dynamic Link",
options="customer_type", options="customer_type",
insert_after="customer_type" insert_after="customer_type"
),
dict(
fieldname="contacts",
label="Contacts",
fieldtype="Table",
options="Address Contact Link",
insert_after="customer_name"
),
dict(
fieldname="companies",
label="Companies",
fieldtype="Table",
options="Address Company Link",
insert_after="contacts"
) )
], ],
"Contact": [ "Contact": [
@ -325,27 +199,6 @@ def add_custom_fields():
fieldtype="Data", fieldtype="Data",
insert_after="last_name", insert_after="last_name",
options="Email" options="Email"
),
dict(
fieldname="customer_type",
label="Customer Type",
fieldtype="Select",
options="Customer\nLead",
insert_after="email"
),
dict(
fieldname="customer_name",
label="Customer Name",
fieldtype="Dynamic Link",
options="customer_type",
insert_after="customer_type"
),
dict(
fieldname="addresses",
label="Addresses",
fieldtype="Table",
options="Contact Address Link",
insert_after="customer_name"
) )
], ],
"On-Site Meeting": [ "On-Site Meeting": [
@ -404,13 +257,6 @@ def add_custom_fields():
fieldtype="Link", fieldtype="Link",
options="Contact", options="Contact",
insert_after="party_name" insert_after="party_name"
),
dict(
fieldname="project_template",
label="Project Template",
fieldtype="Link",
options="Project Template",
insert_after="company"
) )
], ],
"Quotation": [ "Quotation": [
@ -453,27 +299,6 @@ def add_custom_fields():
fieldtype="Link", fieldtype="Link",
options="On-Site Meeting", options="On-Site Meeting",
insert_after="custom_job_address" 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="customer",
label="Customer",
fieldtype="Dynamic Link",
options="customer_type",
insert_after="from_onsite_meeting"
),
dict(
fieldname="customer_type",
label="Customer Type",
fieldtype="Select",
options="Customer\nLead",
insert_after="customer_name"
) )
], ],
"Sales Order": [ "Sales Order": [
@ -812,14 +637,15 @@ def update_address_fields():
field_counters['address_linked_to_customer'] += 1 field_counters['address_linked_to_customer'] += 1
field_counters['total_field_updates'] += 1 field_counters['total_field_updates'] += 1
if doc['doctype'] == "Task": if doc['doctype'] == "Task":
property = frappe.get_value("Task", doc["name"], "custom_property") for task_name in tasks:
project = frappe.get_value("Task", doc["name"], "project") property = frappe.get_value("Task", task_name, "custom_property")
project_address = frappe.get_value("Project", project, "custom_installation_address") project = frappe.get_value("Task", task_name, "project")
alt_project_address = frappe.get_value("Project", project, "custom_address") project_address = frappe.get_value("Project", project, "custom_installation_address")
if (project_address or alt_project_address) and not property: alt_project_address = frappe.get_value("Project", project, "custom_address")
frappe.db.set_value("Task", doc["name"], "custom_property", project_address if project_address else alt_project_address) if project_address or alt_project_address:
field_counters['tasks_updated'] += 1 frappe.db.set_value("Task", task_name, "custom_property", project_address if project_address else alt_project_address)
field_counters['total_field_updates'] += 1 field_counters['tasks_updated'] += 1
field_counters['total_field_updates'] += 1