summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/solr/product_template.py
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-10-20 15:31:03 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-10-20 15:31:03 +0700
commit49d7b473a8cd458ade6a4e703c276b0771707db2 (patch)
tree4b5e6aa8681f16cc02464f92fef1e07210d9300c /indoteknik_custom/models/solr/product_template.py
parent4570401835223c2b613c2739fe9684fbe6c15b94 (diff)
Add unpublished field on product template and variant
Diffstat (limited to 'indoteknik_custom/models/solr/product_template.py')
-rw-r--r--indoteknik_custom/models/solr/product_template.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py
index aa1708cc..25d7d4b8 100644
--- a/indoteknik_custom/models/solr/product_template.py
+++ b/indoteknik_custom/models/solr/product_template.py
@@ -5,6 +5,7 @@ from datetime import datetime
class ProductTemplate(models.Model):
_inherit = "product.template"
+ unpublished = fields.Boolean(string='Unpublished')
last_update_solr = fields.Datetime(string='Last Update Solr')
desc_update_solr = fields.Char(string='Desc Update Solr')
@@ -23,7 +24,7 @@ class ProductTemplate(models.Model):
'function_name': function_name
})
- @api.constrains('name', 'default_code', 'weight', 'x_manufacture', 'public_categ_ids', 'search_rank', 'search_rank_weekly', 'image_1920', 'active')
+ @api.constrains('name', 'default_code', 'weight', 'x_manufacture', 'public_categ_ids', 'search_rank', 'search_rank_weekly', 'image_1920', 'unpublished')
def _create_solr_queue_sync_product_template(self):
self._create_solr_queue('_sync_product_template_to_solr')
@@ -80,7 +81,7 @@ class ProductTemplate(models.Model):
"category_name": category_name,
"description_t": template.website_description or '',
'has_product_info_b': True,
- 'publish_b': template.active and template.type == 'product',
+ 'publish_b': not template.unpublished,
"qty_sold_f": template.qty_sold
})