diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2024-07-26 06:53:58 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2024-07-26 06:53:58 +0000 |
| commit | 310dc5b1ae50cec8e24cc36ace4d440b42f27eff (patch) | |
| tree | e90a3cbec5a494dfaf8ecb8de4e76256c952a91e /indoteknik_custom/models | |
| parent | 88035e3c9586fdd58275834f64b6cad4c8df0711 (diff) | |
| parent | 2813f944bb28906bdc7348bb7437af77a85c68cf (diff) | |
Merged in feature/iman-categories-homepage (pull request #181)
Feature/iman categories homepage
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 | 21 | ||||
| -rw-r--r-- | indoteknik_custom/models/website_categories_lob.py | 15 |
3 files changed, 25 insertions, 12 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 3305c7ba..19143be3 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 + # } }) 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 |
