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

convert_field_to_html: Translatable fields #334

Open
pedrobaeza opened this issue Jul 4, 2023 · 2 comments
Open

convert_field_to_html: Translatable fields #334

pedrobaeza opened this issue Jul 4, 2023 · 2 comments
Labels

Comments

@pedrobaeza
Copy link
Member

There's a problem with the method convert_field_to_html, as it doesn't handle correctly translatable fields.

This method makes simple SQL queries over SQL contents, but on translatable fields < v16, this should touch also ir.translation rows corresponding to each record. But for implementing any sort of this, there's not enough information passed through arguments, as we are passing the table and the field name, but not the model name (which can't be reversed out of the table name, as not all _ may be converted to .).

We also need to modify it to handle JSON translations for >=v16.

Should we change the API for the method? Leave it as is and handle only v16+?

@pedrobaeza pedrobaeza added the bug label Jul 4, 2023
@gdgellatly
Copy link
Contributor

Well I think it should be easy enough to do both.

For v16+ are we not just dumping to a dict, do each value, converting back and writing?
And for the old EAV style, we can do out of band anyway. I think there is enough information because what we know for sure is 1. It will either be a . or _ and 2. There are no duplicates. Therefore a SELECT src, value FROM ir_translation WHERE name like '<table_name>,<field>' ... instead of = and the _ in table name become placeholders.

@aryanfanid
Copy link

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

No branches or pull requests

3 participants