summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/ir_attachment.py
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2025-05-05 09:58:48 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2025-05-05 09:58:48 +0700
commit86cccc64c6f67b031a1bc345aae7922d83e021ea (patch)
tree92732a1c19265d8120ff714135bb8526dfc3117e /indoteknik_custom/models/ir_attachment.py
parent8d4c3a9b7673a17dddec8ece8ea7f75961c8ed54 (diff)
push
Diffstat (limited to 'indoteknik_custom/models/ir_attachment.py')
-rw-r--r--indoteknik_custom/models/ir_attachment.py6
1 files changed, 2 insertions, 4 deletions
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')