From 9fe4b646f1b1cda3d704a66dfbca3e935e38d96b Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 2 Oct 2023 16:45:07 +0700 Subject: Group by brand, sync to solr when validate stock picking, add new name function solr queue --- indoteknik_custom/models/product_template.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'indoteknik_custom/models/product_template.py') diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index d35188b4..defcbdd4 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -52,16 +52,7 @@ class ProductTemplate(models.Model): help='Centang jika ingin ditammpilkan di website sebagai segment Produk Baru') seq_new_product = fields.Integer(string='Seq New Product', help='Urutan Sequence New Product') is_edited = fields.Boolean(string='Is Edited') - publish = fields.Boolean(string='Publish', default=True) - @api.constrains('active') - def constrains_active_publish(self): - if not self.active or self.type != 'product': - self.publish = False - else: - self.publish = True - - self._create_solr_queue('_sync_product_template_to_solr') def day_product_to_edit(self): day_products = [] @@ -193,7 +184,12 @@ class ProductTemplate(models.Model): def _compute_web_price(self): for template in self: - template.web_price = template.product_variant_ids[0].web_price + products = self.env['product.product'].search([ + ('product_tmpl_id', '=', template.id), + ('active', 'in', [True, False]) + ]) + for variants in products: + template.web_price = variants[0].web_price def _have_promotion_program(self): for template in self: -- cgit v1.2.3