From e3c2041a2fc2a8a109433ee10614814015ad91ba Mon Sep 17 00:00:00 2001 From: eman Date: Wed, 9 Oct 2024 04:15:54 +0300 Subject: [PATCH] ensan_> --- odex25_ensan/odex_benefit/__manifest__.py | 2 +- odex25_ensan/odex_benefit/models/benefit.py | 62 +++++------ .../odex_benefit/views/actions_and_menus.xml | 2 +- .../odex_benefit/views/benefit_view.xml | 101 ++++++++++++++---- 4 files changed, 112 insertions(+), 55 deletions(-) diff --git a/odex25_ensan/odex_benefit/__manifest__.py b/odex25_ensan/odex_benefit/__manifest__.py index 1fdf6712c..eb1090049 100644 --- a/odex25_ensan/odex_benefit/__manifest__.py +++ b/odex25_ensan/odex_benefit/__manifest__.py @@ -8,7 +8,7 @@ 'license': 'GPL-3', 'author': 'Expert Ltd', 'depends': ['base', 'takaful_core', 'website', 'account', 'report_xlsx', 'sale', 'product', 'stock', 'hr', - 'purchase'], + 'purchase','web_google_maps'], 'data': [ 'security/security_view.xml', 'security/ir.model.access.csv', diff --git a/odex25_ensan/odex_benefit/models/benefit.py b/odex25_ensan/odex_benefit/models/benefit.py index cb2848edc..e3611f536 100644 --- a/odex25_ensan/odex_benefit/models/benefit.py +++ b/odex25_ensan/odex_benefit/models/benefit.py @@ -650,43 +650,45 @@ class GrantBenefitProfile(models.Model): result = geo_obj.geo_find(search, force_country=country) return result, search + def geo_localize(self): + for location in self.with_context(lang='en_US'): + result = self._geo_localize( + street=location.street, + zip=location.zip, + city=location.city_id.name, + state=location.state_id.name, + country=location.country_id.name, + ) + # url = "http://maps.google.com/maps?oi=map&q=" + if result: + location.write( + { + 'lat': result[0][0], + 'lon': result[0][1], + } + ) + return True + + # if result[1]: + # url += result[1] + # if location.street: + # url += location.street.replace(' ', ',') + # if location.nearby_mosque: + # url += location.nearby_mosque.replace(' ', ',') + # + # return { + # 'type': 'ir.actions.act_url', + # 'target': 'new', + # 'url': url + # } # def geo_localize(self): # for location in self.with_context(lang='en_US'): - # result = self._geo_localize( - # street=location.street, - # zip=location.zip, - # city=location.city_id.name, - # state=location.state_id.name, - # country=location.country_id.name, - # ) - # url = "http://maps.google.com/maps?oi=map&q=" - # if result: - # location.write( - # { - # 'lat': result[0][0], - # 'lon': result[0][1], - # } - # ) - # if result[1]: - # url += result[1] - # if location.street: - # url += location.street.replace(' ', ',') - # if location.nearby_mosque: - # url += location.nearby_mosque.replace(' ', ',') - # + # url = location.location_url # return { # 'type': 'ir.actions.act_url', # 'target': 'new', # 'url': url # } - def geo_localize(self): - for location in self.with_context(lang='en_US'): - url = location.location_url - return { - 'type': 'ir.actions.act_url', - 'target': 'new', - 'url': url - } @api.depends('mother_marital', 'mother_income', 'mother_location', 'mother_country_id', 'state') def check_mother_status(self): diff --git a/odex25_ensan/odex_benefit/views/actions_and_menus.xml b/odex25_ensan/odex_benefit/views/actions_and_menus.xml index c8804f6ce..b75e196ff 100644 --- a/odex25_ensan/odex_benefit/views/actions_and_menus.xml +++ b/odex25_ensan/odex_benefit/views/actions_and_menus.xml @@ -6,7 +6,7 @@ Benefits Dashboard grant.benefit - kanban,form,tree,activity + kanban,form,tree,activity,google_map diff --git a/odex25_ensan/odex_benefit/views/benefit_view.xml b/odex25_ensan/odex_benefit/views/benefit_view.xml index abc19cc59..5ed8e1c70 100644 --- a/odex25_ensan/odex_benefit/views/benefit_view.xml +++ b/odex25_ensan/odex_benefit/views/benefit_view.xml @@ -201,8 +201,10 @@ -