Don't bug out if stores, departments fields aren't present for Employee
This commit is contained in:
parent
c525b16581
commit
4afe8e900e
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue