Fix default selection bug for store/department time sheet filters
This commit is contained in:
parent
e9322628cb
commit
d550efbf8f
|
@ -197,6 +197,11 @@ class TimeSheetView(View):
|
|||
form.set_widget('store', forms.widgets.PlainSelectWidget(values=store_values))
|
||||
if context['store']:
|
||||
form.set_default('store', context['store'].uuid)
|
||||
else:
|
||||
# TODO: why is this necessary? somehow the previous store is being
|
||||
# preserved as the "default" when switching from single store view
|
||||
# to "all stores" view
|
||||
form.set_default('store', '')
|
||||
|
||||
departments = self.get_departments()
|
||||
department_values = [(d.uuid, d.name) for d in departments]
|
||||
|
@ -204,6 +209,11 @@ class TimeSheetView(View):
|
|||
form.set_widget('department', forms.widgets.PlainSelectWidget(values=department_values))
|
||||
if context['department']:
|
||||
form.set_default('department', context['department'].uuid)
|
||||
else:
|
||||
# TODO: why is this necessary? somehow the previous dept is being
|
||||
# preserved as the "default" when switching from single dept view
|
||||
# to "all depts" view
|
||||
form.set_default('department', '')
|
||||
|
||||
form.set_type('date', 'date_jquery')
|
||||
form.set_default('date', get_sunday(context['date']))
|
||||
|
|
Loading…
Reference in a new issue