diff options
Diffstat (limited to 'indoteknik_custom/models/product_template.py')
| -rwxr-xr-x | indoteknik_custom/models/product_template.py | 16 |
1 files changed, 6 insertions, 10 deletions
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: |
