diff options
Diffstat (limited to 'indoteknik_custom/models/product_template.py')
| -rwxr-xr-x | indoteknik_custom/models/product_template.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 4c11dcef..f186c2bf 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -52,6 +52,16 @@ 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') @api.constrains('name', 'default_code') def _check_duplicate_product(self): |
