diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-07-26 15:43:46 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-07-26 15:43:46 +0700 |
| commit | 525072694a3544d65a1075d6087600edbe173f18 (patch) | |
| tree | 8963a437df3e40a57f9f95633e58c652e9d7a452 /indoteknik_custom/models | |
| parent | 5e6c42803281ffc3098061113ca153a59a6eeb58 (diff) | |
| parent | 54f5accd8e23cdc944f74dcf4399ac1d21455065 (diff) | |
Merge branch 'production' of bitbucket.org:altafixco/indoteknik-addons into production
Diffstat (limited to 'indoteknik_custom/models')
| -rwxr-xr-x | indoteknik_custom/models/__init__.py | 1 | ||||
| -rw-r--r-- | indoteknik_custom/models/solr/product_template.py | 26 | ||||
| -rw-r--r-- | indoteknik_custom/models/website_categories_lob.py | 15 |
3 files changed, 28 insertions, 14 deletions
diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index ee9c9429..116354d6 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -37,6 +37,7 @@ from . import user_company_request from . import users from . import website_brand_homepage from . import website_categories_homepage +from . import website_categories_lob from . import website_categories_management from . import website_content from . import website_page_content diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py index 3d7d3a80..19143be3 100644 --- a/indoteknik_custom/models/solr/product_template.py +++ b/indoteknik_custom/models/solr/product_template.py @@ -65,11 +65,9 @@ class ProductTemplate(models.Model): variant_names = ', '.join([x.display_name or '' for x in template.product_variant_ids]) variant_codes = ', '.join([x.default_code or '' for x in template.product_variant_ids]) - category_id = 0 - category_name = '' - for category in template.public_categ_ids: - category_id, category_name = category.id, category.name - break + # Mengumpulkan semua kategori + 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({ @@ -92,21 +90,21 @@ 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": category_id, - "category_name_s": category_name, - "category_name": category_name, + "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 '', 'has_product_info_b': True, 'publish_b': not template.unpublished, '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 + # } }) self.solr().add(docs=[document], softCommit=True) diff --git a/indoteknik_custom/models/website_categories_lob.py b/indoteknik_custom/models/website_categories_lob.py new file mode 100644 index 00000000..88182ba5 --- /dev/null +++ b/indoteknik_custom/models/website_categories_lob.py @@ -0,0 +1,15 @@ +from odoo import fields, models + + +class WebsiteCategoriesLob(models.Model): + _name = 'website.categories.lob' + _rec_name = 'category_id' + + 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([ + ('tayang', 'Tayang'), + ('tidak_tayang', 'Tidak Tayang') + ], string='Status') + category_ids = fields.Many2many('product.public.category', string='Category Parent')
\ No newline at end of file |
