Skip to content

[14.0][FIX] sale_commission_product_criteria: address same label warning#669

Open
HekkiMelody wants to merge 1 commit intoOCA:14.0from
PyTech-SRL:14.0-product_criteria-warning
Open

[14.0][FIX] sale_commission_product_criteria: address same label warning#669
HekkiMelody wants to merge 1 commit intoOCA:14.0from
PyTech-SRL:14.0-product_criteria-warning

Conversation

@HekkiMelody
Copy link
Copy Markdown
Contributor

Fixes the following warning

2026-03-31 12:14:35,919 1 WARNING devel odoo.addons.base.models.ir_model: Two fields (commission_type, commission_id) of commission.item() have the same label: Commission Type. 

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @PicchiSeba, @ilyasProgrammer, @renda-dev, @aleuffre,
some modules you are maintaining are being modified, check this out!

@HekkiMelody
Copy link
Copy Markdown
Contributor Author

Pre-commit failure addressed in #670

Comment on lines +120 to +122
commission_type = fields.Selection(
[("fixed", "Fixed"), ("percentage", "Percentage")],
string="Type",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Before this change both commission_type and commission are labeled Commission Type.
After this change commission_type is labeled Type and commission is labeled Commission Type.
I think the new behavior is just as confusing as the old one.

Maybe the real problem is a few lines above:

    commission_id = fields.Many2one(
        "sale.commission",
        string="Commission Type",

why don't we:

  • label commission_id as Commission
  • label commission_type as Commission Type

?

This would also be aligned with 18.0, see

commission_id = fields.Many2one(
"commission",
string="Commission",
domain=[("commission_type", "=", "product")],
required=True,
)
and
commission_type = fields.Selection(
[("fixed", "Fixed"), ("percentage", "Percentage")],
index=True,
default="fixed",
required=True,
)
.

In order to achieve this result, we can just remove string from both fields, or change Commission Type to Commission as it is in 18.0.
What do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed string attribute from both fields (fewer lines of code is always good!) to adhere to the same nomenclature as v18.

Thank you for the suggestion.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

@HekkiMelody HekkiMelody force-pushed the 14.0-product_criteria-warning branch from 297b85d to eb07d9e Compare April 7, 2026 15:56
Comment on lines +120 to +122
commission_type = fields.Selection(
[("fixed", "Fixed"), ("percentage", "Percentage")],
string="Type",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

@SirPyTech SirPyTech force-pushed the 14.0-product_criteria-warning branch from eb07d9e to babd78c Compare April 8, 2026 12:08
@SirPyTech
Copy link
Copy Markdown

Rebased to include #670.

Copy link
Copy Markdown
Contributor

@francesco-ooops francesco-ooops left a comment

Choose a reason for hiding this comment

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

LGTM

@OCA-git-bot
Copy link
Copy Markdown
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants