fix(Issue): track issue split from (#18995)

* fix: track issue split from

* fix: comment on issue split

* Update issue.py
This commit is contained in:
Himanshu
2019-09-11 19:20:47 +05:30
committed by Nabin Hait
parent d225f5993b
commit cf71643685
2 changed files with 1081 additions and 1037 deletions

View File

@@ -354,6 +354,40 @@
"translatable": 0, "translatable": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "issue_split_from",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Issue Split From",
"length": 0,
"no_copy": 0,
"options": "Issue",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_in_quick_entry": 0, "allow_in_quick_entry": 0,
@@ -1067,7 +1101,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2019-04-24 23:09:48.711076", "modified": "2019-09-11 08:31:47.300943",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Support", "module": "Support",
"name": "Issue", "name": "Issue",

View File

@@ -87,6 +87,7 @@ class Issue(Document):
from copy import deepcopy from copy import deepcopy
replicated_issue = deepcopy(self) replicated_issue = deepcopy(self)
replicated_issue.subject = subject replicated_issue.subject = subject
replicated_issue.issue_split_from = self.name
frappe.get_doc(replicated_issue).insert() frappe.get_doc(replicated_issue).insert()
# Replicate linked Communications # Replicate linked Communications
# todo get all communications in timeline before this, and modify them to append them to new doc # todo get all communications in timeline before this, and modify them to append them to new doc
@@ -96,6 +97,15 @@ class Issue(Document):
doc = frappe.get_doc("Communication", communication.name) doc = frappe.get_doc("Communication", communication.name)
doc.reference_name = replicated_issue.name doc.reference_name = replicated_issue.name
doc.save(ignore_permissions=True) doc.save(ignore_permissions=True)
frappe.get_doc({
"doctype": "Comment",
"comment_type": "Info",
"reference_doctype": "Issue",
"reference_name": replicated_issue.name,
"content": " - Split the Issue from <a href='#Form/Issue/{0}'>{1}</a>".format(self.name, frappe.bold(self.name))
}).insert(ignore_permissions=True)
return replicated_issue.name return replicated_issue.name
def get_list_context(context=None): def get_list_context(context=None):