-
-
Notifications
You must be signed in to change notification settings - Fork 572
[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
[18.0][MIG] base_tier_validation_forward #1065
Conversation
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/
… avoid errors TT33369
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.
Quick code review. :+1
7503df2
to
ed7db7d
Compare
This PR has the |
_inherit = "tier.review" | ||
_order = "sequence" | ||
|
||
name = fields.Char(compute="_compute_definition_data", store=True, related=False) |
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.
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.
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.
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.
@astirpe I can't reproduce to error. Can you help steps to reproduct please?
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.
@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.
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.
@astirpe I added translate=True on name field. please re-check.
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.
Thank you!
ed7db7d
to
14d5ffb
Compare
/ocabot migration base_tier_validation_forward |
14d5ffb
to
232ecdc
Compare
This PR has the |
/ocabot merge nobump |
Hey, thanks for contributing! Proceeding to merge this for you. |
Congratulations, your PR was merged at 2de9263. Thanks a lot for contributing to OCA. ❤️ |
This PR continue from #1022
cc: @absal-smile