diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-10-25 08:47:36 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-10-25 08:47:36 +0700 |
| commit | 9fa80c62cdffec5b91aaf2a2899d70d0f507c2e4 (patch) | |
| tree | 93ae8d82f774345f650bc8d072dea759c6e33363 /indoteknik_api/controllers/api_v1/city.py | |
| parent | a21c5fe37529b2d2259d3b86d8e98730b2bc8513 (diff) | |
| parent | a7be93f4825967807f12e6bfbebcf090af8500fa (diff) | |
Merge branch 'production' into iman/switch-account
# Conflicts:
# indoteknik_api/controllers/api_v1/user.py
# indoteknik_custom/models/user_company_request.py
Diffstat (limited to 'indoteknik_api/controllers/api_v1/city.py')
| -rw-r--r-- | indoteknik_api/controllers/api_v1/city.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/indoteknik_api/controllers/api_v1/city.py b/indoteknik_api/controllers/api_v1/city.py index 6e0e3edb..afe92c4a 100644 --- a/indoteknik_api/controllers/api_v1/city.py +++ b/indoteknik_api/controllers/api_v1/city.py @@ -15,10 +15,16 @@ class City(controller.Controller): name = '%' + name.replace(' ', '%') + '%' parameters.append(('name', 'ilike', name)) - cities = request.env['vit.kota'].search(parameters) + state_id = kw.get('state_id') + if state_id: + parameters.append(('state_id', '=', int(state_id))) + + districts = request.env['vit.kota'].search(parameters) data = [] - for city in cities: - data.append({ 'id': city.id, 'name': city.name }) + for district in districts: + data.append({ 'id': district.id, 'name': district.name }) return self.response(data) + + |
