Skip to content
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

Open
wants to merge 1 commit into
base: 18.0
Choose a base branch
from

Conversation

Ricardo-MC
Copy link

@Ricardo-MC Ricardo-MC commented Feb 21, 2025

Added 'order' argument with a default value to avoid errors in staging in the contacts view.

@OCA-git-bot
Copy link
Contributor

Hi @dreispt,
some modules you are maintaining are being modified, check this out!

Comment on lines +18 to +19
order = order or "sequence, id"
return stages.search([], order=order)
Copy link
Member

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?

Suggested change
order = order or "sequence, id"
return stages.search([], order=order)
return stages.search([], order=order or "sequence, id")

Comment on lines +17 to +19
def _read_group_stage_id(self, stages, domain, order=None):
order = order or "sequence, id"
return stages.search([], order=order)
Copy link

@celm1990 celm1990 Feb 21, 2025

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:

Suggested change
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants