diff options
Diffstat (limited to 'indoteknik_custom/models/product_attribute.py')
| -rw-r--r-- | indoteknik_custom/models/product_attribute.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/indoteknik_custom/models/product_attribute.py b/indoteknik_custom/models/product_attribute.py index 51ef97cf..784ccd81 100644 --- a/indoteknik_custom/models/product_attribute.py +++ b/indoteknik_custom/models/product_attribute.py @@ -7,7 +7,9 @@ class ProductAttributeValue(models.Model): @api.constrains('name') def _validate_name(self): - pattern = r'^[a-zA-Z0-9\[\]\(\)\.\s/]+$' + 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.') + pattern_suggest = r'[a-zA-Z0-9\[\]\(\)\.\s/%]+' + suggest = ''.join(re.findall(pattern_suggest, self.name)) + raise UserError(f'Nama hanya bisa menggunakan angka, huruf kecil, huruf besar, titik, kurung lengkung, kurung siku, garis miring. Contoh: {suggest}')
\ No newline at end of file |
