diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-07-26 13:48:31 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-07-26 13:48:31 +0700 |
| commit | e394d734ca4e53bd63b767c9c7fe77a5ebe49245 (patch) | |
| tree | 2e1397c560b490e930a4f5b123286b11f57cc215 /indoteknik_custom | |
| parent | 4b855ffcaeee0d961bb900f4cc9d4665cee87dd4 (diff) | |
<iman> add website categories lob
Diffstat (limited to 'indoteknik_custom')
| -rw-r--r-- | indoteknik_custom/models/solr/product_template.py | 21 | ||||
| -rw-r--r-- | indoteknik_custom/models/website_categories_lob.py | 2 |
2 files changed, 10 insertions, 13 deletions
diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py index 4bf0b88d..2143fbe2 100644 --- a/indoteknik_custom/models/solr/product_template.py +++ b/indoteknik_custom/models/solr/product_template.py @@ -66,11 +66,8 @@ class ProductTemplate(models.Model): variant_codes = ', '.join([x.default_code or '' for x in template.product_variant_ids]) # Mengumpulkan semua kategori - category_ids = [] - category_names = [] - for category in template.public_categ_ids: - category_ids.append(category.id) - category_names.append(category.name) + category_ids = [category.id for category in template.public_categ_ids] + category_names = [category.name for category in template.public_categ_ids] document = solr_model.get_doc('product', template.id) document.update({ @@ -93,7 +90,7 @@ class ProductTemplate(models.Model): "variants_code_t": variant_codes, "search_rank_i": template.search_rank, "search_rank_weekly_i": template.search_rank_weekly, - "category_id_i": ','.join(map(str, category_ids)), # ID kategori sebagai string yang dipisahkan koma + "category_id_ids": category_ids, # ID kategori sebagai string yang dipisahkan koma "category_name_s": ', '.join(category_names), # Nama kategori sebagai string yang dipisahkan koma "category_name": category_names, # Nama kategori sebagai list "description_t": template.website_description or '', @@ -102,12 +99,12 @@ class ProductTemplate(models.Model): 'sni_b': template.unpublished, 'tkdn_b': template.unpublished, "qty_sold_f": template.qty_sold, - "voucher_pastihemat" : { - "min_purchase" : voucher.min_purchase_amount, - "discount_type" : voucher.discount_type, - "discount_amount" : voucher.discount_amount, - "max_discount" : voucher.max_discount_amount - } + # "voucher_pastihemat" : { + # "min_purchase" : voucher.min_purchase_amount, + # "discount_type" : voucher.discount_type, + # "discount_amount" : voucher.discount_amount, + # "max_discount" : voucher.max_discount_amount + # } }) print(document) diff --git a/indoteknik_custom/models/website_categories_lob.py b/indoteknik_custom/models/website_categories_lob.py index 5fd7bfef..88182ba5 100644 --- a/indoteknik_custom/models/website_categories_lob.py +++ b/indoteknik_custom/models/website_categories_lob.py @@ -5,7 +5,7 @@ class WebsiteCategoriesLob(models.Model): _name = 'website.categories.lob' _rec_name = 'category_id' - category_id = fields.Many2one('res.partner.industry', string='Category', help='table ecommerce category') + category_id = fields.Many2one('res.partner.industry', string='Industri', help='table ecommerce category') image = fields.Binary(string='Image') sequence = fields.Integer(string='Sequence') status = fields.Selection([ |
