|
@@ -315,8 +315,7 @@ def get_link_fields(doctype): |
|
|
|
|
|
|
|
|
def update_options_for_fieldtype(fieldtype, old, new): |
|
|
def update_options_for_fieldtype(fieldtype, old, new): |
|
|
if frappe.conf.developer_mode: |
|
|
if frappe.conf.developer_mode: |
|
|
for name in frappe.db.sql_list("""select parent from |
|
|
|
|
|
tabDocField where options=%s""", old): |
|
|
|
|
|
|
|
|
for name in frappe.get_all("DocField", filters={"options": old}, pluck="parent"): |
|
|
doctype = frappe.get_doc("DocType", name) |
|
|
doctype = frappe.get_doc("DocType", name) |
|
|
save = False |
|
|
save = False |
|
|
for f in doctype.fields: |
|
|
for f in doctype.fields: |
|
@@ -422,20 +421,21 @@ def update_parenttype_values(old, new): |
|
|
child_doctypes += custom_child_doctypes |
|
|
child_doctypes += custom_child_doctypes |
|
|
fields = [d['fieldname'] for d in child_doctypes] |
|
|
fields = [d['fieldname'] for d in child_doctypes] |
|
|
|
|
|
|
|
|
property_setter_child_doctypes = frappe.db.sql("""\ |
|
|
|
|
|
select value as options from `tabProperty Setter` |
|
|
|
|
|
where doc_type=%s and property='options' and |
|
|
|
|
|
field_name in ("%s")""" % ('%s', '", "'.join(fields)), |
|
|
|
|
|
(new,)) |
|
|
|
|
|
|
|
|
property_setter_child_doctypes = frappe.get_all( |
|
|
|
|
|
"Property Setter", |
|
|
|
|
|
filters={ |
|
|
|
|
|
"doc_type": new, |
|
|
|
|
|
"property": "options", |
|
|
|
|
|
"field_name": ("in", fields) |
|
|
|
|
|
}, |
|
|
|
|
|
pluck="value" |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
child_doctypes = list(d['options'] for d in child_doctypes) |
|
|
child_doctypes += property_setter_child_doctypes |
|
|
child_doctypes += property_setter_child_doctypes |
|
|
child_doctypes = (d['options'] for d in child_doctypes) |
|
|
|
|
|
|
|
|
|
|
|
for doctype in child_doctypes: |
|
|
for doctype in child_doctypes: |
|
|
frappe.db.sql("""\ |
|
|
|
|
|
update `tab%s` set parenttype=%s |
|
|
|
|
|
where parenttype=%s""" % (doctype, '%s', '%s'), |
|
|
|
|
|
(new, old)) |
|
|
|
|
|
|
|
|
frappe.db.sql(f"update `tab{doctype}` set parenttype=%s where parenttype=%s", (new, old)) |
|
|
|
|
|
|
|
|
def rename_dynamic_links(doctype, old, new): |
|
|
def rename_dynamic_links(doctype, old, new): |
|
|
for df in get_dynamic_link_map().get(doctype, []): |
|
|
for df in get_dynamic_link_map().get(doctype, []): |
|
|