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
[IMP] base: _has_cycle replaces _check_recursion in SQL #162656
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@kmagusiak since we have our naming convension for branch names I create a new PR for merging. |
rco-odoo
force-pushed
the
master-base-check-cycle-sql-cwg
branch
from
April 26, 2024 12:16
1f1302b
to
284e87b
Compare
Implement the detection of cycles using a single recursive SQL query, for the sake of performance. The query starts from self.ids and follows the relation defined by the field. The good part is that we can use the same query for both many2many and many2one fields. The new method _has_cycle() returns True if some records are reachable from self and are part of a cycle, even if those records are not part of self. This is acceptable, because this method is called after modifying some records, and we assume that the unchanged records did not contain a loop beforehand.
rco-odoo
force-pushed
the
master-base-check-cycle-sql-cwg
branch
from
April 26, 2024 12:19
284e87b
to
8490bc2
Compare
rco-odoo
approved these changes
Apr 26, 2024
@robodoo r+ |
robodoo
pushed a commit
that referenced
this pull request
Apr 26, 2024
Implement the detection of cycles using a single recursive SQL query, for the sake of performance. The query starts from self.ids and follows the relation defined by the field. The good part is that we can use the same query for both many2many and many2one fields. The new method _has_cycle() returns True if some records are reachable from self and are part of a cycle, even if those records are not part of self. This is acceptable, because this method is called after modifying some records, and we assume that the unchanged records did not contain a loop beforehand. closes #162656 Related: odoo/enterprise#61159 Signed-off-by: Raphael Collet <rco@odoo.com>
MohammedBasioni
pushed a commit
to odoo-dev/odoo
that referenced
this pull request
May 6, 2024
Implement the detection of cycles using a single recursive SQL query, for the sake of performance. The query starts from self.ids and follows the relation defined by the field. The good part is that we can use the same query for both many2many and many2one fields. The new method _has_cycle() returns True if some records are reachable from self and are part of a cycle, even if those records are not part of self. This is acceptable, because this method is called after modifying some records, and we assume that the unchanged records did not contain a loop beforehand. closes odoo#162656 Related: odoo/enterprise#61159 Signed-off-by: Raphael Collet <rco@odoo.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implement the detection of cycles using a single recursive SQL query, for the sake of performance. The query starts from
self.ids
and follows the relation defined by the field. The good part is that we can use the same query for both many2many and many2one fields.The new method
_has_cycle()
returnsTrue
if some records are reachable fromself
and are part of a cycle, even if those records are not part ofself
. This is acceptable, because this method is called after modifying some records, and we assume that the unchanged records did not contain a loop beforehand.