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.

37 lines
1.4 KiB

  1. -
  2. Write french phone numbers in national format
  3. -
  4. !record {model: res.partner, id: partner1}:
  5. name: Pierre Paillet
  6. mobile: 06 42 77 42 66
  7. fax: (0) 1 45 42 12 42
  8. -
  9. Write swiss phone numbers in international format
  10. -
  11. !record {model: res.partner, id: partner2}:
  12. name: Joël Grand-Guillaume
  13. parent_id: base.res_partner_12
  14. phone: +41 21 619 10 10
  15. mobile: +41 79 606 42 42
  16. -
  17. Write invalid phone number
  18. -
  19. !record {model: res.partner, id: partner3}:
  20. name: Jean Badphone
  21. phone: 42
  22. -
  23. Check that valid phone numbers have been converted to E.164
  24. -
  25. !python {model: res.partner}: |
  26. partner1 = self.browse(cr, uid, ref('partner1'), context=context)
  27. assert partner1.mobile == '+33642774266', 'Mobile number not written in E.164 format (partner1)'
  28. assert partner1.fax == '+33145421242', 'Fax number not written in E.164 format (partner1)'
  29. partner2 = self.browse(cr, uid, ref('partner2'), context=context)
  30. assert partner2.phone == '+41216191010', 'Phone number not written in E.164 format (partner2)'
  31. assert partner2.mobile == '+41796064242', 'Mobile number not written in E.164 format (partner2)'
  32. -
  33. Check that invalid phone numbers are kept unchanged
  34. -
  35. !python {model: res.partner}: |
  36. partner3 = self.browse(cr, uid, ref('partner3'), context=context)
  37. assert partner3.phone == '42', 'Invalid phone numbers should not be changed'