fix - pos sharing on agc bug fixed influently

This commit is contained in:
2025-12-22 09:42:22 +03:30
parent 4096dbbd6e
commit 65a826ab7f
8 changed files with 115 additions and 65 deletions

View File

@@ -1,6 +1,7 @@
from django.db import models
from apps.authentication import models as auth_models
from apps.authentication.models import Organization
from apps.core.models import BaseModel
@@ -82,6 +83,13 @@ class Herd(BaseModel):
class Rancher(BaseModel):
organization = models.ForeignKey(
Organization,
on_delete=models.CASCADE,
related_name='ranchers',
null=True,
help_text="connect ranchers to their specific Taavoni" # noqa
)
ranching_farm = models.CharField(max_length=150, null=True)
union_name = models.CharField(max_length=50, null=True, blank=True)
union_code = models.CharField(max_length=50, null=True, blank=True)

View File

@@ -225,7 +225,7 @@ class RancherViewSet(BaseViewSet, RancherDashboardService, SoftDeleteMixin, view
url_name='rancher_dashboard_by_quota_usage',
name='rancher_dashboard_by_quota_usage'
)
def rancher_dashboard_by_quota_usage(self, request, pk=None):
def ranchers_dashboard_by_quota_usage(self, request, pk=None):
""" rancher dashboard """
rancher = self.get_object()
@@ -261,3 +261,37 @@ class RancherViewSet(BaseViewSet, RancherDashboardService, SoftDeleteMixin, view
rancher=rancher
)
return Response(rancher_dashboard_data)
@action(
methods=['get'],
detail=False,
url_name='org_ranchers',
url_path='org_ranchers',
name='org_ranchers'
)
def org_ranchers(self, request):
"""
list of ranchers by organization
"""
queryset = self.get_queryset(visibility_by_org_scope=True)
page = self.paginate_queryset(queryset)
if page is not None: # noqa
serializer = product_serializers.IncentivePlanRancherSerializer(page, many=True)
return self.get_paginated_response(serializer.data)
return Response(status=status.HTTP_200_OK)
@action(
methods=['get'],
detail=False,
url_name='org_ranchers_dashboard',
url_path='org_ranchers_dashboard',
name='org_ranchers_dashboard'
)
def org_ranchers_dashboard(self, request):
"""
dashboard of ranchers report
"""
queryset = self.get_queryset(visibility_by_org_scope=True)

View File

@@ -1,5 +1,6 @@
from django.urls import path, include
from rest_framework import routers
from .api import HerdViewSet, RancherViewSet
router = routers.DefaultRouter()
@@ -8,4 +9,4 @@ router.register('rancher', RancherViewSet, basename='rancher')
urlpatterns = [
path('api/v1/', include(router.urls))
]
]