From 7e02e1c3cd8657903e449b66207bd22480c2f490 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 19 Feb 2019 22:53:31 +0530 Subject: [PATCH] fix: not able to cancel maintenance visit --- .../maintenance_visit/maintenance_visit.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.py b/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.py index 6d082bd200..2f2ad00e02 100644 --- a/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.py +++ b/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.py @@ -41,12 +41,19 @@ class MaintenanceVisit(TransactionBase): work_done = nm and nm[0][3] or '' else: status = 'Open' - mntc_date = '' - service_person = '' - work_done = '' + mntc_date = None + service_person = None + work_done = None - frappe.db.sql("update `tabWarranty Claim` set resolution_date=%s, resolved_by=%s, resolution_details=%s, status=%s where name =%s",(mntc_date,service_person,work_done,status,d.prevdoc_docname)) + wc_doc = frappe.get_doc('Warranty Claim', d.prevdoc_docname) + wc_doc.update({ + 'resolution_date': mntc_date, + 'resolved_by': service_person, + 'resolution_details': work_done, + 'status': status + }) + wc_doc.db_update() def check_if_last_visit(self): """check if last maintenance visit against same sales order/ Warranty Claim"""