Compare commits
3 commits
841d52c61a
...
d53ebf9ecd
| Author | SHA1 | Date | |
|---|---|---|---|
| d53ebf9ecd | |||
| 00319f856a | |||
| 562e386766 |
2 changed files with 2850 additions and 20 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -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,6 +80,34 @@ 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",
|
||||||
|
|
@ -100,18 +128,102 @@ 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",
|
||||||
|
|
@ -183,6 +295,20 @@ 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": [
|
||||||
|
|
@ -199,6 +325,27 @@ 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": [
|
||||||
|
|
@ -257,6 +404,13 @@ 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": [
|
||||||
|
|
@ -299,6 +453,27 @@ 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": [
|
||||||
|
|
@ -637,13 +812,12 @@ 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":
|
||||||
for task_name in tasks:
|
property = frappe.get_value("Task", doc["name"], "custom_property")
|
||||||
property = frappe.get_value("Task", task_name, "custom_property")
|
project = frappe.get_value("Task", doc["name"], "project")
|
||||||
project = frappe.get_value("Task", task_name, "project")
|
|
||||||
project_address = frappe.get_value("Project", project, "custom_installation_address")
|
project_address = frappe.get_value("Project", project, "custom_installation_address")
|
||||||
alt_project_address = frappe.get_value("Project", project, "custom_address")
|
alt_project_address = frappe.get_value("Project", project, "custom_address")
|
||||||
if project_address or alt_project_address:
|
if (project_address or alt_project_address) and not property:
|
||||||
frappe.db.set_value("Task", task_name, "custom_property", project_address if project_address else alt_project_address)
|
frappe.db.set_value("Task", doc["name"], "custom_property", project_address if project_address else alt_project_address)
|
||||||
field_counters['tasks_updated'] += 1
|
field_counters['tasks_updated'] += 1
|
||||||
field_counters['total_field_updates'] += 1
|
field_counters['total_field_updates'] += 1
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue