summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-04-03 16:13:36 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-04-03 16:13:36 +0700
commit3a15f04a073aa196305f4904dd3ef044a908aaf8 (patch)
tree8777612efacef0b39aaeb4229833dfd9692a5b7e
parent81459d357684bed948dce1ade7d195036c99a82d (diff)
add commerce category for sync to solr
-rw-r--r--indoteknik_custom/models/apache_solr.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/indoteknik_custom/models/apache_solr.py b/indoteknik_custom/models/apache_solr.py
index cbc63a1e..b19f585f 100644
--- a/indoteknik_custom/models/apache_solr.py
+++ b/indoteknik_custom/models/apache_solr.py
@@ -47,6 +47,10 @@ class ApacheSolr(models.Model):
discount = template.product_variant_id._get_website_disc(0)
price_excl_after_disc = template.product_variant_id._get_website_price_after_disc_and_tax()
tax = template.product_variant_id._get_website_tax()
+
+ for category in template.public_categ_ids:
+ category_id = category.id
+ category_name = category.name
document=[({
'id': template.id,
@@ -68,9 +72,9 @@ class ApacheSolr(models.Model):
'manufacture_name': template.x_manufacture.x_name or '',
'image_promotion_1_s': self.env['ir.attachment'].api_image('x_manufactures', 'image_promotion_1', template.x_manufacture.id),
'image_promotion_2_s': self.env['ir.attachment'].api_image('x_manufactures', 'image_promotion_2', template.x_manufacture.id),
- 'category_id_i': template.categ_id.id or 0,
- 'category_name_s': template.categ_id.name or '',
- 'category_name': template.categ_id.name or '',
+ 'category_id_i': category_id or 0,
+ 'category_name_s': category_name or '',
+ 'category_name': category_name or '',
'variants_name_t': variants_name,
'variants_code_t': variants_code,
'search_rank_i': template.search_rank,