fix: migrate lead notes
This commit is contained in:
@@ -9,15 +9,13 @@ def execute():
|
|||||||
|
|
||||||
dt = frappe.qb.DocType(doctype)
|
dt = frappe.qb.DocType(doctype)
|
||||||
records = (
|
records = (
|
||||||
frappe.qb.from_(dt)
|
frappe.qb.from_(dt).select(dt.name, dt.notes).where(dt.notes.isnotnull() & dt.notes != "")
|
||||||
.select(dt.name, dt.notes, dt.modified_by, dt.modified)
|
|
||||||
.where(dt.notes.isnotnull() & dt.notes != "")
|
|
||||||
).run(as_dict=True)
|
).run(as_dict=True)
|
||||||
|
|
||||||
for d in records:
|
for d in records:
|
||||||
if strip_html(cstr(d.notes)).strip():
|
if strip_html(cstr(d.notes)).strip():
|
||||||
doc = frappe.get_doc(doctype, d.name)
|
doc = frappe.get_doc(doctype, d.name)
|
||||||
doc.append("notes", {"note": d.notes, "added_by": d.modified_by, "added_on": d.modified})
|
doc.append("notes", {"note": d.notes})
|
||||||
doc.update_child_table("notes")
|
doc.update_child_table("notes")
|
||||||
|
|
||||||
frappe.db.sql_ddl(f"alter table `tab{doctype}` drop column `notes`")
|
frappe.db.sql_ddl(f"alter table `tab{doctype}` drop column `notes`")
|
||||||
|
|||||||
Reference in New Issue
Block a user