Skip to content

Commit

Permalink
HSC-102: Fix issue with getting record by ID (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
chinzou authored Jun 29, 2022
1 parent f528bf7 commit c4c8745
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tasks:
- init: ./gradlew clean test
3 changes: 2 additions & 1 deletion odoo_initializer/models/base_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ def _pre_process(self, file_, mapping, filters_):

def _record_exist(self, record_id):
cr = registry.cursor
cr.execute("SELECT res_id FROM ir_model_data WHERE name='" + record_id + "';")
db_mode,db_id = record_id.split('.', 1)
cr.execute("SELECT res_id FROM ir_model_data WHERE name='" + db_id + "';")
return cr.dictfetchall() or False

# Rule to delete a field that shouldn't be updated if found, from the record
Expand Down
6 changes: 3 additions & 3 deletions odoo_initializer/tests/test_integration_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ def setUp(self):
@staticmethod
def _get_non_updated_groups():
return [
{"id": "group_test_1", "name": "test_1", "comment": "other"},
{"id": "group_test_2", "name": "test_2", "comment": "filter"},
{"id": "group_test_3", "name": "test_3", "comment": "other"},
{"id": "init.group_test_1", "name": "test_1", "comment": "other"},
{"id": "init.group_test_2", "name": "test_2", "comment": "filter"},
{"id": "init.group_test_3", "name": "test_3", "comment": "other"},
]

def test_load_file_should_import_records(self):
Expand Down

0 comments on commit c4c8745

Please sign in to comment.