Browse Source

fix: mapping to maintenance visit gets erased (#28917)

* fix: mappings to maintenance visit gets erased

* test: mapping of schedule to visit
develop
Noah Jacob 3 years ago
committed by GitHub
parent
commit
4cb5b627a1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py
  2. 2
      erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.js

9
erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py

@ -56,9 +56,14 @@ class TestMaintenanceSchedule(unittest.TestCase):
ms.submit()
s_id = ms.get_pending_data(data_type = "id", item_name = i.item_name, s_date = expected_dates[1])
test = make_maintenance_visit(source_name = ms.name, item_name = "_Test Item", s_id = s_id)
# Check if item is mapped in visit.
test_map_visit = make_maintenance_visit(source_name = ms.name, item_name = "_Test Item", s_id = s_id)
self.assertEqual(len(test_map_visit.purposes), 1)
self.assertEqual(test_map_visit.purposes[0].item_name, "_Test Item")
visit = frappe.new_doc('Maintenance Visit')
visit = test
visit = test_map_visit
visit.maintenance_schedule = ms.name
visit.maintenance_schedule_detail = s_id
visit.completion_status = "Partially Completed"

2
erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.js

@ -47,7 +47,7 @@ frappe.ui.form.on('Maintenance Visit', {
frm.set_value({ status: 'Draft' });
}
if (frm.doc.__islocal) {
frm.clear_table("purposes");
frm.doc.maintenance_type == 'Unscheduled' && frm.clear_table("purposes");
frm.set_value({ mntc_date: frappe.datetime.get_today() });
}
},

Loading…
Cancel
Save