|
@@ -161,7 +161,7 @@ class EmployeeViewSet(CustomModelViewSet):
|
|
|
|
|
|
@action(methods=['post'], detail=True)
|
|
@action(methods=['post'], detail=True)
|
|
def office(self, request, pk):
|
|
def office(self, request, pk):
|
|
- check_permission(request, 'account.office_store')
|
|
|
|
|
|
+ check_permission(request, 'account.manager_store')
|
|
data = json.loads(request.POST.get('stores'))
|
|
data = json.loads(request.POST.get('stores'))
|
|
try:
|
|
try:
|
|
with transaction.atomic():
|
|
with transaction.atomic():
|
|
@@ -326,7 +326,8 @@ class EmployeeTreeView(APIView):
|
|
'field': 'store',
|
|
'field': 'store',
|
|
'children': [],
|
|
'children': [],
|
|
}
|
|
}
|
|
- employees = User.objects.filter(store_id=store_id, is_active=True).values('id', 'name')
|
|
|
|
|
|
+ office_user_id = OfficeStoreUser.objects.filter(store_id=store_id).values('office_user_id')
|
|
|
|
+ employees = User.objects.filter(Q(store_id=store_id) | Q(id__in=office_user_id), is_active=True).values('id', 'name')
|
|
for employee in employees:
|
|
for employee in employees:
|
|
user_item = {
|
|
user_item = {
|
|
'title': employee['name'],
|
|
'title': employee['name'],
|
|
@@ -433,7 +434,7 @@ class HomeStatisticsView(APIView):
|
|
class OfficeStoreView(APIView):
|
|
class OfficeStoreView(APIView):
|
|
permission_classes = [isLogin, ]
|
|
permission_classes = [isLogin, ]
|
|
|
|
|
|
- @permission_required('account.office_store')
|
|
|
|
|
|
+ @permission_required('account.manager_store')
|
|
def get(self, request):
|
|
def get(self, request):
|
|
id = request.GET.get('id')
|
|
id = request.GET.get('id')
|
|
store_data = []
|
|
store_data = []
|
|
@@ -475,4 +476,4 @@ class OfficeStoreView(APIView):
|
|
agent_item['children'].append(store_item)
|
|
agent_item['children'].append(store_item)
|
|
store_data.append(general_agent_item)
|
|
store_data.append(general_agent_item)
|
|
|
|
|
|
- return response_ok(store_data)
|
|
|
|
|
|
+ return response_ok(store_data)
|