diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-07-18 17:23:14 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-07-18 17:23:14 +0700 |
| commit | 555fb9de25e73348297b1af42dcb80bdfdc33113 (patch) | |
| tree | 0a7c42dfe07492291463ae892878a2c08c9f249b | |
| parent | 1b11e4f636d7d0dbac45a7374bc40c29fa15846d (diff) | |
<iman> update solr data object
| -rw-r--r-- | indoteknik_custom/models/solr/website_categories_management.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/indoteknik_custom/models/solr/website_categories_management.py b/indoteknik_custom/models/solr/website_categories_management.py index 15e28df0..2d7e889a 100644 --- a/indoteknik_custom/models/solr/website_categories_management.py +++ b/indoteknik_custom/models/solr/website_categories_management.py @@ -63,21 +63,26 @@ class WebsiteCategoriesManagement(models.Model): category_id2_data = [ { - x.id: { - 'child_frontend_id_i': [child.id for child in x.child_frontend_id2] - } + 'id_level_2': x.id, + 'name': x.name, + 'image': x.image, + 'child_frontend_id_i': [{'id_level_3': child.id, 'name': child.name, 'image': child.image} for child in + x.child_frontend_id2] } for x in category.category_id2 ] - + category_id2_json = json.dumps(category_id2_data) document = solr_model.get_doc('product_category_management', category.id) document.update({ 'id': category.id, 'category_id_i': category.category_id.id, + 'image_s': self.env['ir.attachment'].api_image('product.public.category', 'image', category.category_id.id), 'name_s': category.category_id.name, 'sequence_i': category.sequence or '', - 'category_id2': category_id2_data, + 'category_id2_s': category_id2_json, }) + _logger.info('Category %s synchronized to Solr with document: %s', document) + _logger.info('Category %s synchronized to Solr with category_id2_json: %s', category_id2_json) self.solr().add([document]) category.update_last_update_solr() |
