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.

8 lines
367 B

10 years ago
10 years ago
  1. -
  2. Try fields validator
  3. -
  4. !python {model: ir.model.fields}: |
  5. from openerp.exceptions import Warning
  6. field_ids = self.search(cr, uid, [('name', '=', 'email'), ('model', '=', 'res.partner')])
  7. assert len(field_ids) == 1, 'There must be 1 email field'
  8. self.write(cr, uid, field_ids, {'regex_validator': r'\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b'})