diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2023-08-31 14:06:21 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2023-08-31 14:06:21 +0700 |
| commit | 215fde914a2eae20928b9e40a9a5dd1ac179c4e1 (patch) | |
| tree | ab98adf8d8661aec39deea6b981fbb8f4dd59001 | |
| parent | 3f9ee6e5297afbd7aad670eb061c069621af888e (diff) | |
fix error solr
| -rw-r--r-- | indoteknik_custom/models/solr/product_pricelist_item.py | 24 | ||||
| -rw-r--r-- | indoteknik_custom/models/solr/product_template.py | 1 |
2 files changed, 3 insertions, 22 deletions
diff --git a/indoteknik_custom/models/solr/product_pricelist_item.py b/indoteknik_custom/models/solr/product_pricelist_item.py index 6ab2f588..fa042480 100644 --- a/indoteknik_custom/models/solr/product_pricelist_item.py +++ b/indoteknik_custom/models/solr/product_pricelist_item.py @@ -6,25 +6,5 @@ class ProductPricelistItem(models.Model): @api.constrains('applied_on', 'product_id', 'base', 'base_pricelist_id', 'price_discount') def _constrains_related_solr_field(self): - self.update_template_solr() - self.update_variant_solr() - - def update_template_solr(self): - updated_template_ids = [] - for rec in self: - template = rec.product_id.product_tmpl_id - if template.id in updated_template_ids: - continue - - template._sync_price_to_solr() - updated_template_ids.append(template.id) - - def update_variant_solr(self): - updated_product_ids = [] - for rec in self: - product = rec.product_id - if product.id in updated_product_ids: - continue - - product._sync_price_to_solr() - updated_product_ids.append(product.id)
\ No newline at end of file + for rec in self: + rec.product_id.product_tmpl_id._create_solr_queue('_sync_price_to_solr')
\ No newline at end of file diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py index 6ae0bec2..692eaa94 100644 --- a/indoteknik_custom/models/solr/product_template.py +++ b/indoteknik_custom/models/solr/product_template.py @@ -151,6 +151,7 @@ class ProductTemplate(models.Model): 'has_price_info_b': True }) self.solr().add([document]) + template.product_variant_ids._sync_price_to_solr() template.change_solr_data('Ada perubahan pada harga product') if not document.get('has_product_info_b'): |
