From 8449e2ef1b9b23eaa39bd6eba4c5885433c367d0 Mon Sep 17 00:00:00 2001 From: Mojtaba-z Date: Sun, 8 Feb 2026 16:33:40 +0330 Subject: [PATCH] fix --> edit addresses org bug --- apps/authentication/api/v1/api.py | 4 +++- apps/herd/services/herd_rancher_sync.py | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/authentication/api/v1/api.py b/apps/authentication/api/v1/api.py index bb981cf..26aa96e 100644 --- a/apps/authentication/api/v1/api.py +++ b/apps/authentication/api/v1/api.py @@ -337,7 +337,9 @@ class OrganizationViewSet(BaseViewSet, ModelViewSet, DynamicSearchMixin): if 'addresses' in request.data.keys(): # import multiple addresses with postal_code to orgs - organization.locations.delete() # remove ex locations + locations = organization.locations.all() + locations.delete() # remove ex locations + # create new locations address_obj_list = [] for addr in request.data['addresses']: diff --git a/apps/herd/services/herd_rancher_sync.py b/apps/herd/services/herd_rancher_sync.py index b4d3507..0570a09 100644 --- a/apps/herd/services/herd_rancher_sync.py +++ b/apps/herd/services/herd_rancher_sync.py @@ -42,7 +42,6 @@ class HerdRancherSyncService: seen_in_batch = set() for temp in queryset.iterator(chunk_size=batch_size): - rancher = rancher_map.get(temp.rancher_national_code) if not rancher: @@ -52,7 +51,7 @@ class HerdRancherSyncService: national_code=temp.rancher_national_code, rancher_type='N', city_id=city_map.get(temp.city.strip()), - province_id=30 + province_id=28 ) new_ranchers.append(rancher) rancher_map[temp.rancher_national_code] = rancher @@ -78,7 +77,7 @@ class HerdRancherSyncService: postal=temp.postal_code, unit_unique_id=temp.unit_unique_id, city_id=city_map.get(temp.city.strip()), - province_id=30 + province_id=28 ) } )