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.

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