Skip to content

[18.0][MIG] product_price_category#3618

Merged
OCA-git-bot merged 17 commits into
OCA:18.0from
akretion:18.0-mig-product_price_category
Jan 22, 2026
Merged

[18.0][MIG] product_price_category#3618
OCA-git-bot merged 17 commits into
OCA:18.0from
akretion:18.0-mig-product_price_category

Conversation

@bealdav

@bealdav bealdav commented Mar 10, 2025

Copy link
Copy Markdown
Member

No description provided.

@bealdav bealdav force-pushed the 18.0-mig-product_price_category branch from e9feec7 to e86a5ed Compare March 10, 2025 15:58
@bealdav bealdav marked this pull request as draft March 11, 2025 14:33
@bealdav bealdav closed this Apr 10, 2025
@bealdav bealdav reopened this May 21, 2025
@florian-dacosta florian-dacosta force-pushed the 18.0-mig-product_price_category branch from 7e05e71 to 59bf845 Compare May 21, 2025 14:45
@bealdav bealdav marked this pull request as ready for review May 22, 2025 07:24
@bealdav

bealdav commented May 22, 2025

Copy link
Copy Markdown
Member Author

Just tested, fix done by @florian-dacosta works nicely

I approve it

@florian-dacosta

Copy link
Copy Markdown
Contributor

FYI as last contributor / reviewers, it may be of your interest
@sbejaoui
@rousseldenis
@marielejeune
@flotho
@JordiMForgeFlow

@rousseldenis

Copy link
Copy Markdown
Contributor

/ocabot migration product_price_category

selection_add=[("2b_product_price_category", "Price Category")],
ondelete={"2b_product_price_category": "set default"},
)
display_applied_on = fields.Selection(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@bealdav No need of migration script for this ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hum, true, it is for a new project, and I did not even think about it...
I'll provide one

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for your vigilance @rousseldenis
I've added a migration script.I could not test it on a real migrated database though, but I did test that it runs without crashing


def _compute_name_and_price(self):
result = super()._compute_name_and_price()
def _compute_name(self):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

api.depends should be maintained from the original method

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I did the change.
I hardly believed it was not necessary although it does not hurt.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@JordiMForgeFlow For depends(), Odoo will append new dependencies in further modules that decorates same function. That's why you don't need to put original fields in it. @florian-dacosta This is why it worked without. This is not necessary.

I'm wondering if price_category_id should not be in depends ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I've just rebased this old PR.
@rousseldenis , concerning if price_category_id should trigger this method, on my side I think not.
I've tested here

Image Image

On save computed name is refreshed when you change the price category

It seems to me we have answered all questions.

A merge can be done ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Please @rousseldenis are these screens anwser to your questions ?
Could you merge if it's ok ?

@sebastienbeau sebastienbeau Jan 13, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@florian-dacosta can you remove the useless depends field added
I confirm that it's useless and also it propagate a wrong believe that you need to add all the depends
The code in V18 here : https://github.com/odoo/odoo/blob/dc9dc90dd99f1f7dfb4a781ad2bec7378548d95b/odoo/fields.py#L585 will aggregate the depends. It's the case since version 13 at least and maybe even before (but I do not remember)

Regarding the fact of add "price_category_id" it's needed. The rule is simple if the result of computation of the field depend on "price_category_id", you have to add it.

Right now the onchange is broken (the name only change when you save it). I am pretty sure that if you do an import (an update) it will not update the name if there is not depends on "price_category_id"

So please add it

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@rousseldenis we finally found you're right about depends on price_category_id.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK for me

grindtildeath and others added 12 commits December 23, 2025 15:32
[UPD] Update product_price_category.pot

[ADD] icon.png
Currently translated at 73.3% (11 of 15 strings)

Translation: sale-workflow-10.0/sale-workflow-10.0-product_price_category
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-10-0/sale-workflow-10-0-product_price_category/it/
Currently translated at 100.0% (15 of 15 strings)

Translation: sale-workflow-10.0/sale-workflow-10.0-product_price_category
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-10-0/sale-workflow-10-0-product_price_category/ca/
Currently translated at 100.0% (15 of 15 strings)

Translation: sale-workflow-10.0/sale-workflow-10.0-product_price_category
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-10-0/sale-workflow-10-0-product_price_category/es/

[UPD] Switch to Github Actions / Copier update
[FIX] - fix ui

Co-authored-by: Laurent Mignon (ACSONE) <laurent.mignon@acsone.eu>
Prior to this commit `name` was not correctly computed when `applied_on`
value is `2b_product_price_category`.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: sale-workflow-16.0/sale-workflow-16.0-product_price_category
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-product_price_category/
@bealdav bealdav force-pushed the 18.0-mig-product_price_category branch from 355c4e7 to 812cb68 Compare December 23, 2025 14:33
@bealdav bealdav force-pushed the 18.0-mig-product_price_category branch from b3753ee to 3d6aa3e Compare January 20, 2026 11:58

@florian-dacosta florian-dacosta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Functional test + new review
All seems good, thanks @bealdav

@sebastienbeau sebastienbeau left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM (code review)


def _compute_name_and_price(self):
result = super()._compute_name_and_price()
def _compute_name(self):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK for me

@OCA-git-bot

Copy link
Copy Markdown
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 18.0-ocabot-merge-pr-3618-by-sebastienbeau-bump-patch, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Jan 22, 2026
Signed-off-by sebastienbeau
@sebastienbeau

Copy link
Copy Markdown
Member

/ocabot merge nobump

@OCA-git-bot

Copy link
Copy Markdown
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 18.0-ocabot-merge-pr-3618-by-sebastienbeau-bump-nobump, awaiting test results.

@OCA-git-bot

Copy link
Copy Markdown
Contributor

@sebastienbeau your merge command was aborted due to failed check(s), which you can inspect on this commit of 18.0-ocabot-merge-pr-3618-by-sebastienbeau-bump-patch.

After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red.

@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). 🤖

@OCA-git-bot OCA-git-bot merged commit 0fb6bf4 into OCA:18.0 Jan 22, 2026
9 checks passed
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at 5155df7. Thanks a lot for contributing to OCA. ❤️

@bealdav bealdav deleted the 18.0-mig-product_price_category branch January 22, 2026 13:38
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.