from odoo import fields, models, api, _ from odoo.exceptions import AccessError, UserError, ValidationError import re class ProductAttributeValue(models.Model): _inherit = 'product.attribute.value' @api.constrains('name') def _validate_name(self): pattern = r'^[a-zA-Z0-9\[\]\(\)\.\s/]+$' if not re.match(pattern, self.name): raise UserError('Nama hanya bisa menggunakan angka, huruf kecil, huruf besar, titik, kurung lengkung, kurung siku, garis miring.')