8000 [18.0][MIG] base_tier_validation_forward by Saran440 · Pull Request #1065 · OCA/server-ux · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[18.0][MIG] base_tier_validation_forward #1065

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

Merged

Conversation

Saran440
Copy link
Member

This PR continue from #1022

cc: @absal-smile

kittiu and others added 30 commits April 16, 2025 15:32
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: server-ux-16.0/server-ux-16.0-base_tier_validation_forward
Translate-URL: https://translation.odoo-community.org/projects/server-ux-16-0/server-ux-16-0-base_tier_validation_forward/
Currently translated at 100.0% (35 of 35 strings)

Translation: server-ux-16.0/server-ux-16.0-base_tier_validation_forward
Translate-URL: https://translation.odoo-community.org/projects/server-ux-16-0/server-ux-16-0-base_tier_validation_forward/es/
Copy link
Contributor
@bosd bosd left a comment

Choose a reason for hiding this comment

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

Quick code review. :+1

@Saran440 Saran440 force-pushed the 18.0-mig-base_tier_validation_forward branch from 7503df2 to ed7db7d Compare April 21, 2025 08:05
@OCA-git-bot
Copy link
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). 🤖

_inherit = "tier.review"
_order = "sequence"

name = fields.Char(compute="_compute_definition_data", store=True, related=False)
Copy link
Member

Choose a reason for hiding this comment

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

We spotted a bug when we tried to install this 18.0 module to a customer.
To fix the bug, here we need a translate=True as well.

Suggested change
name = fields.Char(compute="_compute_definition_data", store=True, related=False)
name = fields.Char(compute="_compute_definition_data", store=True, related=False, translate=True)

Explanation:
In base_tier_validation field name is a related field and is translate=True. But here the related field is replaced with a computed field. This seems causing the loosing the translate=True setting for this field.

In _compute_definition_data(...) we have this line:
rec.name = rec.definition_id.name

In case multiple languages are installed, you will get the following error:

psycopg2.errors.UndefinedFunction: function jsonb_path_query_first(character varying, unknown) does not exist
LINE 4: 'en_US', jsonb_path_query_fi...
^

The reason is that the jsonb string in rec.definition_id.name is assigned to rec.name which is a varchar.

Not sure if the explanation is clear, just let me know if you need more info.

Copy link
Member Author

Choose a reason for hiding this comment

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

@astirpe I can't reproduce to error. Can you help steps to reproduct please?

Copy link
Member

Choose a reason for hiding this comment

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

@Saran440
I tried to reproduce it locally but I didn't get the error this time. I was only getting the error on a customer environment, don't know why. Sorry.
However it's already fixed now by putting translate=True on the field definition.

Besides of the error, I still think that translate=True is needed here.
And also, in the compute method, instead of this line:
rec.name = rec.definition_id.name
we need a deepcopy of the definition_id.name, so that all the translations will be copied.

Copy link
Member Author

Choose a reason for hiding this comment

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

@astirpe I added translate=True on name field. please re-check.

Copy link
Member

Choose a reason for hiding this comment

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

Thank you!

6DAF

@Saran440 Saran440 force-pushed the 18.0-mig-base_tier_validation_forward branch from ed7db7d to 14d5ffb Compare April 28, 2025 09:55
@simahawk
Copy link
Contributor

/ocabot migration base_tier_validation_forward

@OCA-git-bot OCA-git-bot added this to the 18.0 milestone Apr 28, 2025
@OCA-git-bot OCA-git-bot mentioned this pull request Apr 28, 2025
21 tasks
@Saran440 Saran440 force-pushed the 18.0-mig-base_tier_validation_forward branch from 14d5ffb to 232ecdc Compare April 29, 2025 06:19
@OCA-git-bot
Copy link
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). 🤖

@simahawk
Copy link
Contributor
simahawk commented May 7, 2025

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 18.0-ocabot-merge-pr-1065-by-simahawk-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 3b6ec55 into OCA:18.0 May 7, 2025
7 checks passed
@OCA-git-bot
Copy link
Contributor

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

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.

0