summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2024-12-04 14:10:10 +0700
committerstephanchrst <stephanchrst@gmail.com>2024-12-04 14:10:10 +0700
commitc60a7a4b0844fe04ec29656b185b9fa80d398c26 (patch)
tree1d15773ac5b9e86c6b6f4171b4234e74ddc058b0
parent9b4ee2c98ca1537282b6ce9a0aff5c556d2be5a9 (diff)
add validation mandatory category
-rwxr-xr-xindoteknik_custom/models/product_template.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py
index 4d186568..6fb8c7a0 100755
--- a/indoteknik_custom/models/product_template.py
+++ b/indoteknik_custom/models/product_template.py
@@ -66,7 +66,7 @@ class ProductTemplate(models.Model):
@api.constrains('name', 'internal_reference', 'x_manufacture')
def required_public_categ_ids(self):
for rec in self:
- if not rec.public_categ_ids:
+ if not rec.public_categ_ids and rec.type == 'product':
raise UserError('Field Categories harus diisi')
def _get_qty_sold(self):
@@ -388,7 +388,7 @@ class ProductProduct(models.Model):
@api.constrains('name', 'internal_reference', 'x_manufacture')
def required_public_categ_ids(self):
for rec in self:
- if not rec.public_categ_ids:
+ if not rec.public_categ_ids and rec.type == 'product':
raise UserError('Field Categories harus diisi')
@api.constrains('active')