diff options
Diffstat (limited to 'indoteknik_custom/models/solr/product_template.py')
| -rw-r--r-- | indoteknik_custom/models/solr/product_template.py | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py index b4782d1c..e39530a7 100644 --- a/indoteknik_custom/models/solr/product_template.py +++ b/indoteknik_custom/models/solr/product_template.py @@ -23,23 +23,7 @@ class ProductTemplate(models.Model): 'function_name': function_name }) - @api.constrains('active', 'type') - def constrains_active(self): - for template in self: - template.publish = template.active and template.type == 'product' - self._create_solr_queue('_sync_product_template_to_solr') - - @api.constrains('publish') - def constrains_publish(self): - for template in self: - if template.active and template.type == 'product': - continue - template.product_variant_ids.publish = template.publish - self._create_solr_queue('_sync_product_template_to_solr') - - constrains_active._priority = 1 - - @api.constrains('name', 'default_code', 'weight', 'x_manufacture', 'public_categ_ids', 'search_rank', 'search_rank_weekly', 'image_1920') + @api.constrains('name', 'default_code', 'weight', 'x_manufacture', 'public_categ_ids', 'search_rank', 'search_rank_weekly', 'image_1920', 'active') def _create_solr_queue_sync_product_template(self): self._create_solr_queue('_sync_product_template_to_solr') @@ -54,6 +38,9 @@ class ProductTemplate(models.Model): product._create_solr_queue('_sync_price_to_solr') product.solr_flag = 1 + def _sync_product_stock_to_solr(self): + self._sync_product_template_to_solr() + def _sync_product_template_to_solr(self): solr_model = self.env['apache.solr'] @@ -93,7 +80,7 @@ class ProductTemplate(models.Model): "category_name": category_name, "description_t": template.website_description or '', 'has_product_info_b': True, - 'publish_b': template.publish + 'publish_b': template.active and template.type == 'product' }) self.solr().add(docs=[document], softCommit=True) |
