You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
diff --git a/openebs/form_kv17.py b/openebs/form_kv17.py
index e43cadb..faa299b 100644
--- a/openebs/form_kv17.py+++ b/openebs/form_kv17.py@@ -369,7 +369,7 @@ class Kv17ChangeForm(forms.ModelForm):
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
# Unfortunately, we can't place this any earlier, because we don't have the dataownercode there
if self.instance.line.dataownercode == self.instance.dataownercode:
@@ -428,7 +428,7 @@ class Kv17ChangeForm(forms.ModelForm):
# 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
# Unfortunately, we can't place this any earlier, because we don't have the dataownercode there
if self.instance.journey.dataownercode == self.instance.dataownercode:
@@ -466,7 +466,7 @@ class Kv17ChangeForm(forms.ModelForm):
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
# Unfortunately, we can't place this any earlier, because we don't have the dataownercode there
if self.instance.dataownercode == self.user.userprofile.company:
@@ -928,7 +928,7 @@ class Kv17ShortenForm(forms.ModelForm):
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.monitoring_error = None
if len(self.instance.recovered_changes) > 0:
self.instance.monitoring_error = self.instance.recovered_changes[0].monitoring_error
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: