[FIX] event: handle error in res partner while evaluating static map url

This traceback raises when user click 'send by email' of 'event registration'.

Error: 'Expected singleton: res.partner(20, 19)'

On '_compute_static_map_url_is_valid' method self is referenced to get
'static_map_url'.
when self is having multiple records, it is used to get
'static_map_url', which leads to above traceback.
See:
https://github.com/odoo/odoo/blob/6f45bf0f496db37b28e8c4f8cc23b0eeec683c90/addons/event/models/res_partner.py#L32-L40
sentry-4359170170

closes odoo/odoo#132560

X-original-commit: 1da387373f772c487fa7391aa24be57b464bb5f3
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
althaf shaik
2023-08-21 19:57:46 +02:00
parent fe593090cc
commit f16b92a8af
+2 -1
View File
@@ -29,6 +29,7 @@ class ResPartner(models.Model):
for partner in self:
partner.static_map_url = partner._google_map_signed_img(zoom=13, width=598, height=200)
@api.depends('static_map_url')
def _compute_static_map_url_is_valid(self):
"""Compute whether the link is valid.
@@ -37,7 +38,7 @@ class ResPartner(models.Model):
"""
session = requests.Session()
for partner in self:
url = self.static_map_url
url = partner.static_map_url
if not url:
partner.static_map_url_is_valid = False
continue