-
-
Notifications
You must be signed in to change notification settings - Fork 874
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
[18.0][FIX] partner_stage: Add 'order' in _read_group_stage_id to fix group… #1985
base: 18.0
Are you sure you want to change the base?
Conversation
Hi @dreispt, |
order = order or "sequence, id" | ||
return stages.search([], order=order) |
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.
Even simpler, sparing 1 LOC?
order = order or "sequence, id" | |
return stages.search([], order=order) | |
return stages.search([], order=order or "sequence, id") |
def _read_group_stage_id(self, stages, domain, order=None): | ||
order = order or "sequence, id" | ||
return stages.search([], order=order) |
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.
I'm not sure if this change is correct.
According to the definition, the order parameter should be removed because only two parameters are expected: groups, domain
, not order
:
https://github.com/odoo/odoo/blob/6caa783991dad7272391ae8ea0e76f32eadc9401/odoo/models.py#L2330
The original order should be preserved, like this:
def _read_group_stage_id(self, stages, domain, order=None): | |
order = order or "sequence, id" | |
return stages.search([], order=order) | |
def _read_group_stage_id(self, stages, domain): | |
order = order or "sequence, id" | |
return stages.search([], order=stages._order) |
Additionally, for consistency, this function should now be renamed to _read_group_stage_ids
in both the function definition
and the corresponding field definition
.
For example:
https://github.com/odoo/odoo/blob/6caa783991dad7272391ae8ea0e76f32eadc9401/addons/maintenance/models/maintenance.py#L405-L410
Added 'order' argument with a default value to avoid errors in staging in the contacts view.