fix: miscellaneous changes
This commit is contained in:
parent
0050fb58ff
commit
defe1b2eef
5 changed files with 35 additions and 64 deletions
|
|
@ -43,7 +43,7 @@ frappe.ui.form.on("Communication", {
|
|||
});
|
||||
}
|
||||
|
||||
frm.add_custom_button(__("Add Primary link"), function() {
|
||||
frm.add_custom_button(__("Change Reference Link"), function() {
|
||||
frm.trigger('show_relink_dialog');
|
||||
}, "Links");
|
||||
|
||||
|
|
|
|||
|
|
@ -43,8 +43,11 @@ class ToDo(Document):
|
|||
|
||||
def on_trash(self):
|
||||
# unlink todo from linked comments
|
||||
frappe.db.sql("""update `tabCommunication` set link_doctype=null, link_name=null
|
||||
where link_doctype=%(doctype)s and link_name=%(name)s""", {"doctype": self.doctype, "name": self.name})
|
||||
frappe.db.sql("""
|
||||
delete from `tabDynamic Link`
|
||||
where link_doctype=%(doctype)s and link_name=%(name)s""", {
|
||||
"doctype": self.doctype, "name": self.name
|
||||
})
|
||||
|
||||
self.update_in_reference()
|
||||
|
||||
|
|
|
|||
|
|
@ -166,8 +166,7 @@ def get_communication_data(doctype, name, start=0, limit=20, after=None, fields=
|
|||
`tabCommunication`.sender, `tabCommunication`.sender_full_name, `tabCommunication`.cc, `tabCommunication`.bcc,
|
||||
`tabCommunication`.creation, `tabCommunication`.subject, `tabCommunication`.delivery_status,
|
||||
`tabCommunication`._liked_by, `tabCommunication`.reference_doctype, `tabCommunication`.reference_name,
|
||||
`tabCommunication`.link_doctype, `tabCommunication`.link_name, `tabCommunication`.read_by_recipient,
|
||||
`tabCommunication`.rating
|
||||
`tabCommunication`.read_by_recipient, `tabCommunication`.rating
|
||||
'''
|
||||
|
||||
conditions = '''
|
||||
|
|
|
|||
|
|
@ -241,6 +241,4 @@ frappe.patches.v12_0.reset_home_settings
|
|||
frappe.patches.v12_0.update_print_format_type
|
||||
frappe.patches.v11_0.remove_doctype_user_permissions_for_page_and_report #2019-05-01
|
||||
frappe.patches.v12_0.remove_feedback_rating
|
||||
execute:frappe.reload_doc('core', 'doctype', 'communication')
|
||||
execute:frappe.reload_doc('core', 'doctype', 'dynamic_link')
|
||||
frappe.patches.v12_0.move_timeline_links_to_dynamic_links
|
||||
|
|
@ -3,66 +3,37 @@ from __future__ import unicode_literals
|
|||
import frappe
|
||||
|
||||
def execute():
|
||||
comm_lists = []
|
||||
for communication in frappe.db.sql("""
|
||||
Select
|
||||
`tabCommunication`.name, `tabCommunication`.creation, `tabCommunication`.modified,
|
||||
`tabCommunication`.modified_by,`tabCommunication`.timeline_doctype, `tabCommunication`.timeline_name,
|
||||
`tabCommunication`.link_doctype, `tabCommunication`.link_name
|
||||
from `tabCommunication`
|
||||
where `tabCommunication`.communication_medium='Email'
|
||||
""", as_dict=True):
|
||||
frappe.reload_doc('core', 'doctype', 'communication')
|
||||
|
||||
sql_query = """INSERT INTO `tabDynamic Link`
|
||||
(`idx`, `name`, `parentfield`, `parenttype`, `parent`, `link_doctype`, `link_name`, `creation`,
|
||||
`modified`, `modified_by`)
|
||||
VALUES """
|
||||
|
||||
communications = frappe.db.sql("""
|
||||
Select
|
||||
`tabCommunication`.name, `tabCommunication`.creation, `tabCommunication`.modified,
|
||||
`tabCommunication`.modified_by,`tabCommunication`.timeline_doctype, `tabCommunication`.timeline_name,
|
||||
`tabCommunication`.link_doctype, `tabCommunication`.link_name
|
||||
from `tabCommunication`
|
||||
where `tabCommunication`.communication_medium='Email'
|
||||
""", as_dict=True)
|
||||
|
||||
for communication in communications:
|
||||
counter = 1
|
||||
if communication.timeline_doctype and communication.timeline_name:
|
||||
comm_lists.append(
|
||||
{
|
||||
"idx": counter,
|
||||
"name": frappe.generate_hash(length=10),
|
||||
"parentfield": "timeline_links",
|
||||
"parenttype": "Communication",
|
||||
"parent": communication.name,
|
||||
"link_doctype": communication.timeline_doctype,
|
||||
"link_name": communication.timeline_name,
|
||||
"creation": communication.creation,
|
||||
"modified": communication.modified,
|
||||
"modified_by": communication.modified_by
|
||||
}
|
||||
)
|
||||
sql_query += str((
|
||||
counter, frappe.generate_hash(length=10), "timeline_links", "Communication", communication.name,
|
||||
communication.timeline_doctype, communication.timeline_name, communication.creation,
|
||||
communication.modified, communication.modified_by
|
||||
)) + """, """
|
||||
counter += 1
|
||||
|
||||
if communication.link_doctype and communication.link_name:
|
||||
comm_lists.append(
|
||||
{
|
||||
"idx": counter,
|
||||
"name": frappe.generate_hash(length=10),
|
||||
"parentfield": "timeline_links",
|
||||
"parenttype": "Communication",
|
||||
"parent": communication.name,
|
||||
"link_doctype": communication.link_doctype,
|
||||
"link_name": communication.link_name,
|
||||
"creation": communication.creation,
|
||||
"modified": communication.modified,
|
||||
"modified_by": communication.modified_by
|
||||
}
|
||||
)
|
||||
sql_query += str((
|
||||
counter, frappe.generate_hash(length=10), "timeline_links", "Communication", communication.name,
|
||||
communication.link_doctype, communication.link_name, communication.creation,
|
||||
communication.modified, communication.modified_by
|
||||
)) + """, """
|
||||
|
||||
for comm_list in comm_lists:
|
||||
frappe.db.sql("""
|
||||
INSERT INTO `tabDynamic Link`
|
||||
(`idx`, `name`, `parentfield`, `parenttype`, `parent`, `link_doctype`, `link_name`, `creation`,
|
||||
`modified`, `modified_by`)
|
||||
VALUES
|
||||
(%(idx)s, %(name)s, %(parentfield)s, %(parenttype)s, %(parent)s, %(link_doctype)s, %(link_name)s,%(creation)s,
|
||||
%(modified)s, %(modified_by)s)
|
||||
""",{
|
||||
"idx": comm_list.get("idx"),
|
||||
"name": comm_list.get("name"),
|
||||
"parentfield": comm_list.get("parentfield"),
|
||||
"parenttype": comm_list.get("parenttype"),
|
||||
"parent": comm_list.get("parent"),
|
||||
"link_doctype": comm_list.get("link_doctype"),
|
||||
"link_name": comm_list.get("link_name"),
|
||||
"creation": comm_list.get("creation"),
|
||||
"modified": comm_list.get("modified"),
|
||||
"modified_by": comm_list.get("modified_by")
|
||||
})
|
||||
frappe.db.sql(sql_query)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue