diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2025-05-05 09:58:48 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2025-05-05 09:58:48 +0700 |
| commit | 86cccc64c6f67b031a1bc345aae7922d83e021ea (patch) | |
| tree | 92732a1c19265d8120ff714135bb8526dfc3117e /indoteknik_custom/models | |
| parent | 8d4c3a9b7673a17dddec8ece8ea7f75961c8ed54 (diff) | |
push
Diffstat (limited to 'indoteknik_custom/models')
| -rw-r--r-- | indoteknik_custom/models/ir_attachment.py | 6 | ||||
| -rw-r--r-- | indoteknik_custom/models/solr/product_template.py | 2 |
2 files changed, 3 insertions, 5 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') diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py index 4220f2f5..20402c84 100644 --- a/indoteknik_custom/models/solr/product_template.py +++ b/indoteknik_custom/models/solr/product_template.py @@ -100,7 +100,7 @@ class ProductTemplate(models.Model): "product_rating_f": template.virtual_rating, "product_id_i": template.id, "image_s": self.env['ir.attachment'].api_image('product.template', 'image_512', template.id), - "image_carousels_s": ' || '.join(carousel_images), # Gunakan pemisah yang unik + "image_carousel_ss": carousel_images, 'image_mobile_s': self.env['ir.attachment'].api_image('product.template', 'image_256', template.id), "variant_total_i": template.product_variant_count, "stock_total_f": template.qty_stock_vendor, |
