From 86cccc64c6f67b031a1bc345aae7922d83e021ea Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 5 May 2025 09:58:48 +0700 Subject: push --- indoteknik_custom/models/ir_attachment.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'indoteknik_custom/models/ir_attachment.py') diff --git a/indoteknik_custom/models/ir_attachment.py b/indoteknik_custom/models/ir_attachment.py index 1acd0848..6417fa3f 100644 --- a/indoteknik_custom/models/ir_attachment.py +++ b/indoteknik_custom/models/ir_attachment.py @@ -20,11 +20,9 @@ class Attachment(models.Model): return True if attachment else False def api_image(self, model, field, id): - if not id: - return None - base_url = self.env['ir.config_parameter'].get_param('web.base.url').rstrip('/') + base_url = self.env['ir.config_parameter'].get_param('web.base.url') is_found = self.is_found(model, field, id) - return f"{base_url}/api/image/{model}/{field}/{id}" if is_found else None + return base_url + 'api/image/' + model + '/' + field + '/' + str(id) if is_found else '' def api_image_local(self, model, field, id): base_url = self.env['ir.config_parameter'].get_param('web.base.local_url') -- cgit v1.2.3