Skip to content

Commit

Permalink
fix: table data deleted on submitted maintenance schedule (bp #27513)
Browse files Browse the repository at this point in the history
(cherry picked from commit 5e0b215)

Co-authored-by: Noah Jacob <noahjacobkurian@gmail.com>
  • Loading branch information
frappe-pr-bot and noahjacob authored Sep 15, 2021
1 parent 7d733af commit 4bd1bce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ frappe.ui.form.on('Maintenance Schedule', {
},
refresh: function (frm) {
setTimeout(() => {
frm.toggle_display('generate_schedule', !(frm.is_new()));
frm.toggle_display('generate_schedule', !(frm.is_new() || frm.doc.docstatus));
frm.toggle_display('schedule', !(frm.is_new()));
}, 10);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
class MaintenanceSchedule(TransactionBase):
@frappe.whitelist()
def generate_schedule(self):
if self.docstatus != 0:
return
self.set('schedules', [])
frappe.db.sql("""delete from `tabMaintenance Schedule Detail`
where parent=%s""", (self.name))
count = 1
for d in self.get('items'):
self.validate_maintenance_detail()
Expand Down

0 comments on commit 4bd1bce

Please sign in to comment.