From 49d7b473a8cd458ade6a4e703c276b0771707db2 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 20 Oct 2023 15:31:03 +0700 Subject: Add unpublished field on product template and variant --- indoteknik_custom/models/solr/product_template.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models/solr/product_template.py') 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 }) -- cgit v1.2.3