diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-10-08 15:24:18 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-10-08 15:24:18 +0700 |
| commit | 2fcddbb073a04ed6ba0e9666a8ab5082a3ef4073 (patch) | |
| tree | d4a3a423adf53ea8c086397abbcfe05a369fe637 /indoteknik_api/controllers/api_v1/city.py | |
| parent | ec1e2331be248a505d89c00244d6b0fe5bd61c26 (diff) | |
| parent | ce1c714c95f68b07f9b891600ba1e3b88288652c (diff) | |
Merge branch 'production' into iman/telegram
# Conflicts:
# indoteknik_custom/models/__init__.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) + + |
