summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamesh Patel <kat@odoo.com>2020-09-18 09:11:10 +0000
committerHiral Bhavsar <hbh@odoo.com>2020-10-08 09:11:58 +0000
commitd04a1b869ef73c302dcd9a1cb04f6d952b0a3db3 (patch)
tree88ed8c75c426c73c37f40e6c1fb43d779457f0ce
parent3d9a2de3575777c87327691319d89f9de6b8eada (diff)
[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#58016 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
-rw-r--r--addons/google_drive/models/google_drive.py13
1 files 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')