summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/product_template.py
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2023-09-19 13:23:57 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2023-09-19 13:23:57 +0700
commit1ea160934c67dd9e4ff2a160385f79cd5ad24946 (patch)
treefb8f697f7351f66aa3d092aa9fdc0abb75a1a918 /indoteknik_custom/models/product_template.py
parent074a3fef721e3894cef359390281f59b21e8b9c2 (diff)
add field email to so and sync email so with email partner_id, add field publish to product
Diffstat (limited to 'indoteknik_custom/models/product_template.py')
-rwxr-xr-xindoteknik_custom/models/product_template.py10
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):