fix --> edit addresses org bug

This commit is contained in:
2026-02-08 16:33:40 +03:30
parent 627168b82a
commit 8449e2ef1b
2 changed files with 5 additions and 4 deletions

View File

@@ -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']:

View File

@@ -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
)
}
)