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.

54 lines
1.8 KiB

  1. -
  2. I create the wizard
  3. -
  4. !record {model: better.zip.geonames.import, id: import_wizard_1, view: better_zip_geonames_import_form}:
  5. country_id: base.it
  6. -
  7. I run the import
  8. -
  9. !python {model: better.zip.geonames.import}: |
  10. self.run_import(cr, uid, [ref('import_wizard_1')], context=context)
  11. -
  12. I check the data
  13. -
  14. !python {model: res.better.zip}: |
  15. state_obj = self.pool['res.country.state']
  16. state_ids = state_obj.search(cr, uid, [
  17. ('code', '=', 'LG'),
  18. ('country_id', '=', ref('base.it')),
  19. ], context=context)
  20. assert len(state_ids) == 1, "There must be 1 LG"
  21. zip_ids = self.search(cr, uid, [
  22. ('name', '=', '16017'),
  23. ('city', '=', 'Isola Del Cantone'),
  24. ('state_id', '=', state_ids[0]),
  25. ('country_id', '=', ref('base.it'))
  26. ], context=context)
  27. assert len(zip_ids) == 1, "There must be 1 'Isola Del Cantone'"
  28. -
  29. I create the wizard again
  30. -
  31. !record {model: better.zip.geonames.import, id: import_wizard_2, view: better_zip_geonames_import_form}:
  32. country_id: base.it
  33. -
  34. I run the import again
  35. -
  36. !python {model: better.zip.geonames.import}: |
  37. self.run_import(cr, uid, [ref('import_wizard_2')], context=context)
  38. -
  39. I check the data
  40. -
  41. !python {model: res.better.zip}: |
  42. state_obj = self.pool['res.country.state']
  43. state_ids = state_obj.search(cr, uid, [
  44. ('code', '=', 'LG'),
  45. ('country_id', '=', ref('base.it')),
  46. ], context=context)
  47. assert len(state_ids) == 1, "There must be 1 LG"
  48. zip_ids = self.search(cr, uid, [
  49. ('name', '=', '16017'),
  50. ('city', '=', 'Isola Del Cantone'),
  51. ('state_id', '=', state_ids[0]),
  52. ('country_id', '=', ref('base.it'))
  53. ], context=context)
  54. assert len(zip_ids) == 1, "There must be 1 'Isola Del Cantone'"