Skip to content

Fix when register does not contains 'id' on search #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 19, 2023

Conversation

tinogis
Copy link
Member

@tinogis tinogis commented Jun 14, 2023

In some cases there is registers without 'id' key. CRM [226458]

@tinogis tinogis added the bug label Jun 14, 2023
@tinogis tinogis requested review from ecarreras and polsala June 14, 2023 11:10
@tinogis tinogis self-assigned this Jun 14, 2023
Copy link
Member

@ecarreras ecarreras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

És el mateix, però d'aquesta manera només comprovem si hi ha la clau i ens és igual el valor

orm_mongodb.py Outdated
@@ -502,7 +502,7 @@ def search(self, cr, user, args, offset=0, limit=0, order=None,
modifiers={"$snapshot": False},
sort=self._compute_order(cr, user, order))

res = [x['id'] for x in mongo_cr]
res = [x['id'] for x in mongo_cr if x.get('id')]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
res = [x['id'] for x in mongo_cr if x.get('id')]
res = [x['id'] for x in mongo_cr if 'id' in x]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ecarreras Solved!

@ecarreras ecarreras merged commit 25288f6 into gisce Jun 19, 2023
@ecarreras ecarreras deleted the FIX_no_id_register branch June 19, 2023 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants