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

[13.0][14.0] Selection field in AbstractModel can not be translated. #64065

Open
tanghulu0608 opened this issue Jan 5, 2021 · 13 comments
Open
Labels

Comments

@tanghulu0608
Copy link
Contributor

tanghulu0608 commented Jan 5, 2021

Impacted versions:
[13.0] [14.0]

Steps to reproduce:
1. Code like this:

class A(models.AbstractModel):
    _name = "a.a"

    state = fields.Selection([
        ("one", "One"),
        ("two", "Two"),
    ])

2. In another module ,b, code like this:

class B(models.Model):
    _inherit = "a.a"
    _name = "b.b"

Current behavior:
Selection field from AbstractModel can not be translated on b.b form view.

Expected behavior:
Selection field from AbstractModel CAN be translated on b.b form view.

Video/Screenshot link (optional):
image

sample.zip updated

@tanghulu0608 tanghulu0608 changed the title [13.0] Selection field in AbstractModel can not be translated. [13.0][14.0] Selection field in AbstractModel can not be translated. Jan 5, 2021
@Yenthe666
Copy link
Collaborator

@mart-e can you give feedback on this one?

@tanghulu0608
Copy link
Contributor Author

@Yenthe666 Thanks. 🤗

@mart-e
Copy link
Contributor

mart-e commented Jan 7, 2021

Hi,

Are you sure of your test? Have you correctly installed/updated the module?
Can you make a test PR on github with your code? This way we can test it on runbut because it should work. I have just tested your first code on a 14.0 database and had no issue.

@tanghulu0608
Copy link
Contributor Author

tanghulu0608 commented Jan 7, 2021

@mart-e hi, I came to this issue twice in V13 during my odoo development work.I am very sure about this. V14, I just make a simply test, in my test , this issue exists.
Could you please test it in V13 again?

@mart-e
Copy link
Contributor

mart-e commented Jan 7, 2021

@tanghulu0608 same, I don't have the issue in 13.0 with your code snippet so it's probably another issue. As said above, could you make a PR to show your problem?

@tanghulu0608
Copy link
Contributor Author

@mart-e I have update the sample code. Please try again in V13.
Selection field from AbstractModel can not be translated on b.b form view.

@hefeilaowang
Copy link

hefeilaowang commented Jan 7, 2021

@mart-e It exists. I meet it. In ir_translate, I found it. But, UI doesn't show the translated word.

@pedrobaeza
Copy link
Collaborator

Maybe the problem is that you are working with --dev mode?

@tanghulu0608
Copy link
Contributor Author

@pedrobaeza No.

@memoryliang
Copy link

memoryliang commented Jan 7, 2021

Yes, I have this issue too.

@mart-e
Copy link
Contributor

mart-e commented Jan 7, 2021

Oh ok, with the updated description, the issue is different now ! Indeed, this does not work, I think we already got this issue in the past.
The problem is not related to the translations (the lack of translation is just a symptom) but that the selections for module b have no external ids.

The workaround for this is to define the selection in the actual model it is used (so b.b for you), not in the abstract one. Note this quite specific where an abstract is in one module and used in another. If you define both in the same it should work.
We haven't figured out a way to fix this yet.

@tanghulu0608
Copy link
Contributor Author

tanghulu0608 commented Jan 7, 2021

@mart-e Thank you very much. Wish this will be fixed soon.

@luayalshawi
Copy link

Hi,
This issue is still appears on v15.0.

I understand models.py -> load_views is responsible for returning the fields to the UI.
Any hint on how to solve this would be appreciated? I can contribute to a fix if someone shares a hint.

Thanks

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

7 participants