-
Notifications
You must be signed in to change notification settings - Fork 4
Add support for name_search method
#54
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
base: gisce
Are you sure you want to change the base?
Conversation
Co-authored-by: ecarreras <294235+ecarreras@users.noreply.github.com>
Co-authored-by: ecarreras <294235+ecarreras@users.noreply.github.com>
name_search method
Python Mongo 3 3.11 Tests for mongodb_backend 2 files 2 suites 0s ⏱️ Results for commit 0399127. ♻️ This comment has been updated with latest results. |
Python Mongo 8 3.11 Tests for mongodb_backend 2 files 2 suites 0s ⏱️ Results for commit 0399127. ♻️ This comment has been updated with latest results. |
Python Mongo 5 3.11 Tests for mongodb_backend 2 files 2 suites 0s ⏱️ Results for commit 0399127. ♻️ This comment has been updated with latest results. |
Python Mongo 5 2.7 Tests for mongodb_backend 2 files 2 suites 0s ⏱️ Results for commit 0399127. ♻️ This comment has been updated with latest results. |
Python Mongo 8 2.7 Tests for mongodb_backend 2 files 2 suites 0s ⏱️ Results for commit 0399127. ♻️ This comment has been updated with latest results. |
Python FerretDB 3.11 Tests for mongodb_backend 2 files 2 suites 1s ⏱️ Results for commit 0399127. ♻️ This comment has been updated with latest results. |
Python FerretDB 2.7 Tests for mongodb_backend 2 files 2 suites 1s ⏱️ Results for commit 0399127. ♻️ This comment has been updated with latest results. |
Python Mongo 3 2.7 Tests for mongodb_backend 2 files 2 suites 0s ⏱️ Results for commit 0399127. ♻️ This comment has been updated with latest results. |
|
@copilot you should implement @isolation(readonly=True, isolation_level='repeatable_read')
def name_get(self, cr, user, ids, context=None):
if not context:
context = {}
if not ids:
return []
if isinstance(ids, integer_types):
ids = [ids]
return [(r['id'], tools.ustr(r[self._rec_name])) for r in self.read(cr, user, ids,
[self._rec_name], context, load='_classic_write')]
`` |
…and proper handling Co-authored-by: ecarreras <294235+ecarreras@users.noreply.github.com>
... Updated
Also enhanced tests to cover the new edge cases (single id, empty ids). |
orm_mongodb.py
Outdated
| # nothing to check in schema free... | ||
| pass | ||
|
|
||
| @isolation(readonly=True, isolation_level='repeatable_read') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot remove the decorator we will made a dedicated pull-request later to change all the necessary methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the @isolation decorator from name_get in commit 0399127.
Co-authored-by: ecarreras <294235+ecarreras@users.noreply.github.com>
Implementation Plan for name_search Support
name_searchmethod inorm_mongodb.pyname_searchmethodname_getto match orm implementationSummary
Successfully implemented support for
name_searchin the MongoDB backend for OpenERP and updatedname_getto match the orm implementation.Changes Made
Updated
name_getImplementation (orm_mongodb.py)ids(returns[])idsby converting to listtools.ustr()for proper unicode string handlingload='_classic_write'toread()methodormclass (isolation decorator will be added in a separate PR)name_searchImplementation (orm_mongodb.py)cr,user,name,args,operator,context,limit_rec_namefield for searchingUpdated Tests (
tests/__init__.py)test_name_getto test single id handling_rec_namechangesname_searchtests remain comprehensiveFiles Changed
orm_mongodb.py: Updated name_get method and added name_search methodtests/__init__.py: Enhanced testsSecurity
✅ CodeQL security scan passed with 0 alerts
name_search#46Original prompt
name_search#46💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.