From c74517e50380e3ac5c971e5cc2c13ba96792dadd Mon Sep 17 00:00:00 2001 From: Kamesh Patel Date: Fri, 18 Sep 2020 09:11:10 +0000 Subject: [PATCH] [FIX] google_drive: fix traceback while create templates Before this commit: While creating new templates it will give a traceback After this commit: While creating new templates it will not give a traceback LINKS Task-2334852 closes odoo/odoo#59502 X-original-commit: d04a1b869ef73c302dcd9a1cb04f6d952b0a3db3 Signed-off-by: Thibault Delavallee (tde) --- addons/google_drive/models/google_drive.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/addons/google_drive/models/google_drive.py b/addons/google_drive/models/google_drive.py index 212062bbc70..fc641c04c7f 100644 --- a/addons/google_drive/models/google_drive.py +++ b/addons/google_drive/models/google_drive.py @@ -191,14 +191,15 @@ class GoogleDrive(models.Model): return None def _compute_ressource_id(self): - result = {} for record in self: - word = self._get_key_from_url(record.google_drive_template_url) - if word: - record.google_drive_resource_id = word + if record.google_drive_template_url: + word = self._get_key_from_url(record.google_drive_template_url) + if word: + record.google_drive_resource_id = word + else: + raise UserError(_("Please enter a valid Google Document URL.")) else: - raise UserError(_("Please enter a valid Google Document URL.")) - return result + record.google_drive_resource_id = False def _compute_client_id(self): google_drive_client_id = self.env['ir.config_parameter'].sudo().get_param('google_drive_client_id')