BugFix: Maintenance Visit against Customer Issue
+ Map Item details from Customer Issue into Maintenance Visit Purpose Table + Map Prev DocType and Prev DocName + Changed prevdoc_doctype and prevdoc_docname into Dynamic Link
This commit is contained in:
parent
80a988c04f
commit
3a389788bf
@ -202,6 +202,7 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "resolved_by",
|
"fieldname": "resolved_by",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
|
"ignore_user_permissions": 1,
|
||||||
"in_filter": 1,
|
"in_filter": 1,
|
||||||
"label": "Resolved By",
|
"label": "Resolved By",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
@ -395,7 +396,7 @@
|
|||||||
"icon": "icon-bug",
|
"icon": "icon-bug",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"is_submittable": 0,
|
"is_submittable": 0,
|
||||||
"modified": "2014-06-23 07:55:47.488335",
|
"modified": "2014-07-07 02:47:56.491906",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Support",
|
"module": "Support",
|
||||||
"name": "Customer Issue",
|
"name": "Customer Issue",
|
||||||
|
@ -38,7 +38,11 @@ class CustomerIssue(TransactionBase):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def make_maintenance_visit(source_name, target_doc=None):
|
def make_maintenance_visit(source_name, target_doc=None):
|
||||||
from frappe.model.mapper import get_mapped_doc
|
from frappe.model.mapper import get_mapped_doc, map_child_doc
|
||||||
|
|
||||||
|
def _update_links(source_doc, target_doc, source_parent):
|
||||||
|
target_doc.prevdoc_doctype = source_parent.doctype
|
||||||
|
target_doc.prevdoc_docname = source_parent.name
|
||||||
|
|
||||||
visit = frappe.db.sql("""select t1.name
|
visit = frappe.db.sql("""select t1.name
|
||||||
from `tabMaintenance Visit` t1, `tabMaintenance Visit Purpose` t2
|
from `tabMaintenance Visit` t1, `tabMaintenance Visit Purpose` t2
|
||||||
@ -46,7 +50,7 @@ def make_maintenance_visit(source_name, target_doc=None):
|
|||||||
and t1.docstatus=1 and t1.completion_status='Fully Completed'""", source_name)
|
and t1.docstatus=1 and t1.completion_status='Fully Completed'""", source_name)
|
||||||
|
|
||||||
if not visit:
|
if not visit:
|
||||||
doclist = get_mapped_doc("Customer Issue", source_name, {
|
target_doc = get_mapped_doc("Customer Issue", source_name, {
|
||||||
"Customer Issue": {
|
"Customer Issue": {
|
||||||
"doctype": "Maintenance Visit",
|
"doctype": "Maintenance Visit",
|
||||||
"field_map": {
|
"field_map": {
|
||||||
@ -57,4 +61,12 @@ def make_maintenance_visit(source_name, target_doc=None):
|
|||||||
}
|
}
|
||||||
}, target_doc)
|
}, target_doc)
|
||||||
|
|
||||||
return doclist
|
source_doc = frappe.get_doc("Customer Issue", source_name)
|
||||||
|
if source_doc.get("item_code"):
|
||||||
|
table_map = {
|
||||||
|
"doctype": "Maintenance Visit Purpose",
|
||||||
|
"postprocess": _update_links
|
||||||
|
}
|
||||||
|
map_child_doc(source_doc, target_doc, table_map, source_doc)
|
||||||
|
|
||||||
|
return target_doc
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"autoname": "MVD.#####",
|
"autoname": "MVD.#####",
|
||||||
"creation": "2013-02-22 01:28:06.000000",
|
"creation": "2013-02-22 01:28:06",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"fields": [
|
"fields": [
|
||||||
@ -73,14 +73,31 @@
|
|||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "prevdoc_doctype",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"hidden": 0,
|
||||||
|
"label": "Document Type",
|
||||||
|
"no_copy": 1,
|
||||||
|
"oldfieldname": "prevdoc_doctype",
|
||||||
|
"oldfieldtype": "Data",
|
||||||
|
"options": "DocType",
|
||||||
|
"permlevel": 0,
|
||||||
|
"print_hide": 1,
|
||||||
|
"print_width": "150px",
|
||||||
|
"read_only": 1,
|
||||||
|
"report_hide": 1,
|
||||||
|
"width": "150px"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "prevdoc_docname",
|
"fieldname": "prevdoc_docname",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Dynamic Link",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"label": "Against Document No",
|
"label": "Against Document No",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"oldfieldname": "prevdoc_docname",
|
"oldfieldname": "prevdoc_docname",
|
||||||
"oldfieldtype": "Data",
|
"oldfieldtype": "Data",
|
||||||
|
"options": "prevdoc_doctype",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"print_width": "160px",
|
"print_width": "160px",
|
||||||
@ -102,28 +119,14 @@
|
|||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
"report_hide": 1,
|
"report_hide": 1,
|
||||||
"width": "160px"
|
"width": "160px"
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "prevdoc_doctype",
|
|
||||||
"fieldtype": "Data",
|
|
||||||
"hidden": 0,
|
|
||||||
"label": "Document Type",
|
|
||||||
"no_copy": 1,
|
|
||||||
"oldfieldname": "prevdoc_doctype",
|
|
||||||
"oldfieldtype": "Data",
|
|
||||||
"permlevel": 0,
|
|
||||||
"print_hide": 1,
|
|
||||||
"print_width": "150px",
|
|
||||||
"read_only": 1,
|
|
||||||
"report_hide": 1,
|
|
||||||
"width": "150px"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"modified": "2013-12-20 19:23:20.000000",
|
"modified": "2014-07-07 02:53:48.442249",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Support",
|
"module": "Support",
|
||||||
"name": "Maintenance Visit Purpose",
|
"name": "Maintenance Visit Purpose",
|
||||||
"owner": "ashwini@webnotestech.com"
|
"owner": "ashwini@webnotestech.com",
|
||||||
|
"permissions": []
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user