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.

30 lines
797 B

10 years ago
10 years ago
  1. -
  2. set regex for partner
  3. -
  4. !python {model: ir.model}: |
  5. self.write(cr, uid, [ref('base.model_res_partner')], {
  6. 'validator_line_ids': [(0,0,
  7. {
  8. 'name': ref('base.model_res_partner'),
  9. 'field_id': ref('base.field_res_partner_email'),
  10. 'regex_id': ref('regex_mail'),
  11. })],
  12. })
  13. -
  14. Set valid email
  15. -
  16. !record {model: res.partner, id: base.res_partner_12}:
  17. email: 'info@agilebg.com'
  18. -
  19. Try invalid email
  20. -
  21. !python {model: res.partner}: |
  22. from openerp.osv import orm
  23. try:
  24. self.write(cr, uid, [ref('base.res_partner_12')], {
  25. 'email': 'john',
  26. })
  27. assert False, "An exception should have been raised, 'john' is not a valid email!"
  28. except orm.except_orm:
  29. # exception was raised as expected
  30. pass