Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions openebs/form_kv17.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,8 @@ def save_all_journeys(self, operatingday, begintime, endtime):
self.instance.endtime = endtime
self.instance.is_cancel = True
self.instance.monitoring_error = None
self.instance.showcancelledtrip = True if self.data['showcancelledtrip'] == 'on' else False
self.instance.showcancelledtrip = True if self.data.get('showcancelledtrip', '') == 'on' else False
self.instance.autorecover = True if self.data.get('autorecover', '') == 'on' else False

# Unfortunately, we can't place this any earlier, because we don't have the dataownercode there
if self.instance.line.dataownercode == self.instance.dataownercode:
Expand Down Expand Up @@ -428,7 +429,8 @@ def save_journeys(self, operatingday):
# Shouldn't be necessary, but just in case:
self.instance.begintime = None
self.instance.endtime = None
self.instance.showcancelledtrip = True if self.data['showcancelledtrip'] == 'on' else False
self.instance.showcancelledtrip = True if self.data.get('showcancelledtrip', '') == 'on' else False
self.instance.autorecover = True if self.data.get('autorecover', '') == 'on' else False

# Unfortunately, we can't place this any earlier, because we don't have the dataownercode there
if self.instance.journey.dataownercode == self.instance.dataownercode:
Expand Down Expand Up @@ -466,7 +468,8 @@ def save_all_lines(self, operatingday, begintime, endtime):
self.instance.endtime = endtime
self.instance.is_cancel = True
self.instance.monitoring_error = None
self.instance.showcancelledtrip = True if self.data['showcancelledtrip'] == 'on' else False
self.instance.showcancelledtrip = True if self.data.get('showcancelledtrip', '') == 'on' else False
self.instance.autorecover = True if self.data.get('autorecover', '') == 'on' else False

# Unfortunately, we can't place this any earlier, because we don't have the dataownercode there
if self.instance.dataownercode == self.user.userprofile.company:
Expand Down Expand Up @@ -928,7 +931,8 @@ def save(self, force_insert=False, force_update=False, commit=True):
self.instance.begintime = None
self.instance.endtime = None
self.instance.is_cancel = False
self.instance.showcancelledtrip = True if self.data['showcancelledtrip'] == 'on' else False
self.instance.showcancelledtrip = True if self.data.get('showcancelledtrip', '') == 'on' else False
self.instance.autorecover = True if self.data.get('autorecover', '') == 'on' else False
self.instance.monitoring_error = None
if len(self.instance.recovered_changes) > 0:
self.instance.monitoring_error = self.instance.recovered_changes[0].monitoring_error
Expand Down