add fixutes and doctypes
This commit is contained in:
parent
841d52c61a
commit
562e386766
File diff suppressed because it is too large
Load Diff
@ -30,7 +30,7 @@ def after_migrate():
|
||||
frappe.clear_cache(doctype=doctype)
|
||||
frappe.reload_doctype(doctype)
|
||||
|
||||
update_address_fields()
|
||||
# update_address_fields()
|
||||
# build_frontend()
|
||||
|
||||
|
||||
@ -80,6 +80,34 @@ def add_custom_fields():
|
||||
options="Customer Company Link",
|
||||
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(
|
||||
fieldname="from_lead",
|
||||
label="From Lead",
|
||||
@ -100,18 +128,102 @@ def add_custom_fields():
|
||||
fieldtype="Table",
|
||||
options="Customer Contact Link",
|
||||
insert_after="properties"
|
||||
),
|
||||
dict(
|
||||
fieldname="primary_contact",
|
||||
label="Primary Contact",
|
||||
fieldtype="Link",
|
||||
options="Contact",
|
||||
insert_after="contacts"
|
||||
)
|
||||
],
|
||||
"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(
|
||||
fieldname="customer_type",
|
||||
label="Customer Type",
|
||||
fieldtype="Select",
|
||||
options="Individual\nCompany\nPartnership",
|
||||
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": [
|
||||
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(
|
||||
fieldname="full_address",
|
||||
label="Full Address",
|
||||
@ -183,6 +295,20 @@ def add_custom_fields():
|
||||
fieldtype="Dynamic Link",
|
||||
options="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": [
|
||||
@ -199,6 +325,27 @@ def add_custom_fields():
|
||||
fieldtype="Data",
|
||||
insert_after="last_name",
|
||||
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": [
|
||||
@ -257,6 +404,13 @@ def add_custom_fields():
|
||||
fieldtype="Link",
|
||||
options="Contact",
|
||||
insert_after="party_name"
|
||||
),
|
||||
dict(
|
||||
fieldname="project_template",
|
||||
label="Project Template",
|
||||
fieldtype="Link",
|
||||
options="Project Template",
|
||||
insert_after="company"
|
||||
)
|
||||
],
|
||||
"Quotation": [
|
||||
@ -299,6 +453,27 @@ def add_custom_fields():
|
||||
fieldtype="Link",
|
||||
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="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": [
|
||||
@ -637,15 +812,14 @@ def update_address_fields():
|
||||
field_counters['address_linked_to_customer'] += 1
|
||||
field_counters['total_field_updates'] += 1
|
||||
if doc['doctype'] == "Task":
|
||||
for task_name in tasks:
|
||||
property = frappe.get_value("Task", task_name, "custom_property")
|
||||
project = frappe.get_value("Task", task_name, "project")
|
||||
project_address = frappe.get_value("Project", project, "custom_installation_address")
|
||||
alt_project_address = frappe.get_value("Project", project, "custom_address")
|
||||
if project_address or alt_project_address:
|
||||
frappe.db.set_value("Task", task_name, "custom_property", project_address if project_address else alt_project_address)
|
||||
field_counters['tasks_updated'] += 1
|
||||
field_counters['total_field_updates'] += 1
|
||||
property = frappe.get_value("Task", doc["name"], "custom_property")
|
||||
project = frappe.get_value("Task", doc["name"], "project")
|
||||
project_address = frappe.get_value("Project", project, "custom_installation_address")
|
||||
alt_project_address = frappe.get_value("Project", project, "custom_address")
|
||||
if (project_address or alt_project_address) and not property:
|
||||
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['total_field_updates'] += 1
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user