diff options
| -rwxr-xr-x | indoteknik_custom/models/product_template.py | 12 | ||||
| -rwxr-xr-x | indoteknik_custom/views/product_template.xml | 3 |
2 files changed, 15 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: diff --git a/indoteknik_custom/views/product_template.xml b/indoteknik_custom/views/product_template.xml index 520af5c8..e3a39412 100755 --- a/indoteknik_custom/views/product_template.xml +++ b/indoteknik_custom/views/product_template.xml @@ -21,6 +21,9 @@ <field name="desc_update_solr" readonly="1" /> <field name="last_update_solr" readonly="1" /> </field> + <field name="public_categ_ids" position="attributes"> + <attribute name="required">1</attribute> + </field> <page name="inventory" position="after"> <page string="Marketplace" name="marketplace"> <group> |
