diff options
| author | Indoteknik . <it@fixcomart.co.id> | 2025-06-17 08:47:53 +0700 |
|---|---|---|
| committer | Indoteknik . <it@fixcomart.co.id> | 2025-06-17 08:47:53 +0700 |
| commit | a80565682063e718fc55c90e4243b9d5b2432285 (patch) | |
| tree | bd3b65cc54b62a8994bafb5d38c25631888d6414 /indoteknik_custom | |
| parent | a8460239603b7a73a185fec394b0f95ab0247207 (diff) | |
(andri) fix load gmaps pada view & edit
Diffstat (limited to 'indoteknik_custom')
| -rw-r--r-- | indoteknik_custom/models/res_partner.py | 14 | ||||
| -rw-r--r-- | indoteknik_custom/views/res_partner.xml | 4 |
2 files changed, 10 insertions, 8 deletions
diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index a8ce95d1..9986b9c0 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -579,9 +579,10 @@ class ResPartner(models.Model): ]) # Ambil API Key - api_key = self.env['ir.config_parameter'].sudo().get_param('google.maps.api_key') - if not api_key: - raise UserError("API Key Google Maps belum dikonfigurasi. Silakan isi melalui Settings.") + api_key = "AIzaSyB7bG9aSNAJnSrj0Z7f1abFsqKVoiJfsPE" + # api_key = self.env['ir.config_parameter'].sudo().get_param('google.maps.api_key') + # if not api_key: + # raise UserError("API Key Google Maps belum dikonfigurasi. Silakan isi melalui Settings.") # Request ke Google Maps url = f'https://maps.googleapis.com/maps/api/geocode/json?address={address}&key={api_key}' @@ -638,9 +639,10 @@ class ResPartner(models.Model): def _reverse_geocode(self, lat, lng): - api_key = self.env['ir.config_parameter'].sudo().get_param('google.maps.api_key') - if not api_key: - raise UserError("API Key Google Maps belum dikonfigurasi.") + api_key = "AIzaSyB7bG9aSNAJnSrj0Z7f1abFsqKVoiJfsPE" + # api_key = self.env['ir.config_parameter'].sudo().get_param('google.maps.api_key') + # if not api_key: + # raise UserError("API Key Google Maps belum dikonfigurasi.") url = f'https://maps.googleapis.com/maps/api/geocode/json?latlng={lat},{lng}&key={api_key}' response = requests.get(url) diff --git a/indoteknik_custom/views/res_partner.xml b/indoteknik_custom/views/res_partner.xml index 2a4b03a7..30b5ca36 100644 --- a/indoteknik_custom/views/res_partner.xml +++ b/indoteknik_custom/views/res_partner.xml @@ -67,9 +67,9 @@ </group> <xpath expr="//notebook/page[@name='contact_addresses']" position="before"> <page string="Pin Point Location" name="map_location"> - <!-- <group> + <group> <button name="geocode_address" type="object" string="Get Pin Point Location" class="btn btn-primary"/> - </group> --> + </group> <div style="margin: 16px 0;"> <field name="map_view" widget="googlemap" nolabel="1"/> </div> |
