summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_custom/models')
-rwxr-xr-xindoteknik_custom/models/product_template.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py
index d51f903f..e6778758 100755
--- a/indoteknik_custom/models/product_template.py
+++ b/indoteknik_custom/models/product_template.py
@@ -61,6 +61,12 @@ class ProductTemplate(models.Model):
tkdn = fields.Boolean(string='TKDN')
short_spesification = fields.Char(string='Short Spesification')
+ @api.constrains('name', 'internal_reference', 'x_manufacture')
+ def required_public_categ_ids(self):
+ for rec in self:
+ if not rec.public_categ_ids:
+ raise UserError('Field Categories harus diisi')
+
def _get_qty_sold(self):
for rec in self:
rec.qty_sold = sum(x.qty_sold for x in rec.product_variant_ids)
@@ -367,6 +373,12 @@ class ProductProduct(models.Model):
qty_sold = fields.Float(string='Sold Quantity', compute='_get_qty_sold')
short_spesification = fields.Char(string='Short Spesification')
+ @api.constrains('name', 'internal_reference', 'x_manufacture')
+ def required_public_categ_ids(self):
+ for rec in self:
+ if not rec.public_categ_ids:
+ raise UserError('Field Categories harus diisi')
+
@api.constrains('active')
def archive_product(self):
for product in self: