Merge pull request #41945 from frappe/mergify/bp/version-15-hotfix/pr-41421

fix: migrate lead notes (backport #41421)
This commit is contained in:
Raffael Meyer
2024-06-19 01:17:52 +02:00
committed by GitHub
2 changed files with 4 additions and 4 deletions

View File

@@ -9,15 +9,13 @@ def execute():
dt = frappe.qb.DocType(doctype)
records = (
frappe.qb.from_(dt)
.select(dt.name, dt.notes, dt.modified_by, dt.modified)
.where(dt.notes.isnotnull() & dt.notes != "")
frappe.qb.from_(dt).select(dt.name, dt.notes).where(dt.notes.isnotnull() & dt.notes != "")
).run(as_dict=True)
for d in records:
if strip_html(cstr(d.notes)).strip():
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")
frappe.db.sql_ddl(f"alter table `tab{doctype}` drop column `notes`")

View File

@@ -12,6 +12,7 @@
{% for(var i=0, l=notes.length; i<l; i++) { %}
<div class="comment-content p-3 row" name="{{ notes[i].name }}">
<div class="mb-2 head col-xs-3">
{% if (notes[i].added_by && notes[i].added_on) %}
<div class="row">
<div class="col-xs-2">
{{ frappe.avatar(notes[i].added_by) }}
@@ -25,6 +26,7 @@
</div>
</div>
</div>
{% } %}
</div>
<div class="content col-xs-8">
{{ notes[i].note }}