Browse Source
[FIX] WARNING test_8 openerp.models: Cannot execute name_search, no _rec_name defined on better.zip.geonames.import
[FIX] WARNING test_8 openerp.models: Cannot execute name_search, no _rec_name defined on better.zip.geonames.import
[REF] porting to new api [IMP] removing 'FOR UPDATE NOWAIT' as ROW EXCLUSIVE lock is already acquired by DELETE and INSERT http://www.postgresql.org/docs/9.2/static/explicit-locking.html [REF] select_or_create_state and tests [FIX] __openerp__.py PEP8 [FIX] TypeError: unlink() got multiple values for keyword argument 'context' [IMP] using ir.config_parameter for geonames URL [FIX] missing cr uid14.0
Lorenzo Battistini
10 years ago
committed by
Pedro M. Baeza
3 changed files with 117 additions and 51 deletions
-
12base_location_geonames_import/__openerp__.py
-
54base_location_geonames_import/test/import.yml
-
100base_location_geonames_import/wizard/geonames_import.py
@ -0,0 +1,54 @@ |
|||||
|
- |
||||
|
I create the wizard |
||||
|
- |
||||
|
!record {model: better.zip.geonames.import, id: import_wizard_1, view: better_zip_geonames_import_form}: |
||||
|
country_id: base.it |
||||
|
- |
||||
|
I run the import |
||||
|
- |
||||
|
!python {model: better.zip.geonames.import}: | |
||||
|
self.run_import(cr, uid, [ref('import_wizard_1')], context=context) |
||||
|
- |
||||
|
I check the data |
||||
|
- |
||||
|
!python {model: res.better.zip}: | |
||||
|
state_obj = self.pool['res.country.state'] |
||||
|
state_ids = state_obj.search(cr, uid, [ |
||||
|
('code', '=', 'LG'), |
||||
|
('country_id', '=', ref('base.it')), |
||||
|
], context=context) |
||||
|
assert len(state_ids) == 1, "There must be 1 LG" |
||||
|
zip_ids = self.search(cr, uid, [ |
||||
|
('name', '=', '16017'), |
||||
|
('city', '=', 'Isola Del Cantone'), |
||||
|
('state_id', '=', state_ids[0]), |
||||
|
('country_id', '=', ref('base.it')) |
||||
|
], context=context) |
||||
|
assert len(zip_ids) == 1, "There must be 1 'Isola Del Cantone'" |
||||
|
- |
||||
|
I create the wizard again |
||||
|
- |
||||
|
!record {model: better.zip.geonames.import, id: import_wizard_2, view: better_zip_geonames_import_form}: |
||||
|
country_id: base.it |
||||
|
- |
||||
|
I run the import again |
||||
|
- |
||||
|
!python {model: better.zip.geonames.import}: | |
||||
|
self.run_import(cr, uid, [ref('import_wizard_2')], context=context) |
||||
|
- |
||||
|
I check the data |
||||
|
- |
||||
|
!python {model: res.better.zip}: | |
||||
|
state_obj = self.pool['res.country.state'] |
||||
|
state_ids = state_obj.search(cr, uid, [ |
||||
|
('code', '=', 'LG'), |
||||
|
('country_id', '=', ref('base.it')), |
||||
|
], context=context) |
||||
|
assert len(state_ids) == 1, "There must be 1 LG" |
||||
|
zip_ids = self.search(cr, uid, [ |
||||
|
('name', '=', '16017'), |
||||
|
('city', '=', 'Isola Del Cantone'), |
||||
|
('state_id', '=', state_ids[0]), |
||||
|
('country_id', '=', ref('base.it')) |
||||
|
], context=context) |
||||
|
assert len(zip_ids) == 1, "There must be 1 'Isola Del Cantone'" |
Write
Preview
Loading…
Cancel
Save
Reference in new issue