You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
708 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright © 2014-2016 Lorenzo Battistini - Agile Business Group
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from openerp import models, fields
  5. class IrModelFieldsRegex(models.Model):
  6. _name = "ir.model.fields.regex"
  7. name = fields.Char('Description', required=True)
  8. regex = fields.Char(
  9. 'Regular Expression', required=True,
  10. help="Regular expression used to validate the field. For example, "
  11. "you can add the expression\n%s\nto the email field"
  12. % r'[^@]+@[^@]+\.[^@]+')
  13. _sql_constraints = [(
  14. 'name_unique', 'unique (name)',
  15. 'The name of a regular expression must be unique'
  16. )]