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

partner_multi_relation - translation of relation types #1337

Open
JonathanStein opened this issue Sep 13, 2022 · 1 comment
Open

partner_multi_relation - translation of relation types #1337

JonathanStein opened this issue Sep 13, 2022 · 1 comment
Labels
bug no stale Use this label to prevent the automated stale action from closing this PR/Issue.

Comments

@JonathanStein
Copy link

Module

partner_multi_relation

Describe the bug

Relation types are translatable, but translations does not work with virtual res.partner.relation.type.selection model

To Reproduce

Affected versions:
Tested with 12.0

Steps to reproduce the behavior:

  1. Create more than ~10 relation types
  2. Create a new relation
  3. When selecting the type, choose "Search more..."

Expected behavior
Relation names should be translated in the list

name_get is implemented so it uses the names from res.partner.relation.type. This brought me to a work around where I replace the name values in a new read method:

    @api.multi
    def read(self, fields=None, load='_classic_read'):
        """ Work around to get names translated """

        result = super().read(fields=None, load='_classic_read')

        if 'name' in fields or not fields:
            try:
                # Translation works with name_get
                names = dict(self.name_get())
                # Replace "name" value with the one from name_get
                for record in result:
                    record['name'] = names[record['id']]
            except:
                pass

        return result

@github-actions
Copy link

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Mar 19, 2023
@NL66278 NL66278 added no stale Use this label to prevent the automated stale action from closing this PR/Issue. and removed stale PR/Issue without recent activity, it'll be soon closed automatically. labels Mar 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug no stale Use this label to prevent the automated stale action from closing this PR/Issue.
Projects
None yet
Development

No branches or pull requests

2 participants