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

Field display_name becomes non-stored #53125

Open
steync027 opened this issue Jun 17, 2020 · 5 comments
Open

Field display_name becomes non-stored #53125

steync027 opened this issue Jun 17, 2020 · 5 comments
Labels
12.0 Need information the reports lacks of information

Comments

@steync027
Copy link

steync027 commented Jun 17, 2020

Impacted versions:

Tested on 12.0

Steps to reproduce:

Create a new module "module_abc"

class ResPartner(models.Model):
    _inherit = 'res.partner'

    @api.depends('field_1', 'field_b')
    def _compute_display_name(self):
        for record in self:
            record.display_name = 'This logic is irrelevant'

    display_name = fields.Char(compute=_compute_display_name, store=True)

Create a second module "module_def"

class ResPartner(models.Model):
    _inherit = 'res.partner'

    some_other_field1 = fields.Char()
    some_other_field2 = fields.Char()

Current behavior:

  • Once you've installed module_abc the display_name is stored

  • Once you install module_def the display_name is no longer stored

  • Even though module_def does not change anything on display_name, the act of inheriting from res.partner will reverse what you have done in module_abc

  • This happens on any model, not only res.partner

Expected behavior:

  • The display_name should be still be stored

Extra references:

@steync027
Copy link
Author

@pedrobaeza I am tagging you because I have a problem exactly the same as you had in the OCA module. Your solution in that module was to re-declare the display_name and re-add the store=True, however I am wondering if this cannot be fixed in Odoo core. If you have any insights I would value it highly.

@pedrobaeza
Copy link
Collaborator

I didn't investigate such problem, but it seems to fix it. It may be an ORM limitation, as a such, difficult to be fixed, and not for an stable version. Anyway, I let it tagged for reference.

@pedrobaeza pedrobaeza added 12.0 Need information the reports lacks of information labels Jun 17, 2020
@steync027
Copy link
Author

Thanks @pedrobaeza I will investigate this further and possibly provide a PR for the issue.

@steync027
Copy link
Author

@pedrobaeza I have proposed a PR

@pedrobaeza
Copy link
Collaborator

Great, let's see what Odoo thinks about it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
12.0 Need information the reports lacks of information
Projects
None yet
Development

No branches or pull requests

2 participants