Don't bug out if stores, departments fields aren't present for Employee

This commit is contained in:
Lance Edgar 2019-10-15 20:33:37 -05:00
parent c525b16581
commit 4afe8e900e

View file

@ -211,6 +211,8 @@ class EmployeesView(MasterView):
return employee
def update_stores(self, employee, data):
if 'stores' not in data:
return
old_stores = set([s.uuid for s in employee.stores])
new_stores = data['stores']
for uuid in new_stores:
@ -222,6 +224,8 @@ class EmployeesView(MasterView):
employee.stores.remove(store)
def update_departments(self, employee, data):
if 'departments' not in data:
return
old_depts = set([d.uuid for d in employee.departments])
new_depts = data['departments']
for uuid in new_depts: