Skip to content

Commit

Permalink
Merge pull request #27990 from noahjacob/maint_schedule_fix
Browse files Browse the repository at this point in the history
fix: changes in schedules gets overwritten on save
  • Loading branch information
noahjacob authored Oct 19, 2021
2 parents 7717b99 + e08a099 commit 01bb97b
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,16 @@ def validate_sales_order(self):
if chk:
throw(_("Maintenance Schedule {0} exists against {1}").format(chk[0][0], d.sales_order))

def validate_no_of_visits(self):
return len(self.schedules) != sum(d.no_of_visits for d in self.items)

def validate(self):
self.validate_end_date_visits()
self.validate_maintenance_detail()
self.validate_dates_with_periodicity()
self.validate_sales_order()
self.generate_schedule()
if not self.schedules or self.validate_no_of_visits():
self.generate_schedule()

def on_update(self):
frappe.db.set(self, 'status', 'Draft')
Expand Down

0 comments on commit 01bb97b

Please sign in to comment.