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

server_env_mixin broken: on 14.0 + 15.0 + 16.0 #151

Closed
simahawk opened this issue Apr 4, 2023 · 1 comment
Closed

server_env_mixin broken: on 14.0 + 15.0 + 16.0 #151

simahawk opened this issue Apr 4, 2023 · 1 comment
Labels

Comments

@simahawk
Copy link

simahawk commented Apr 4, 2023

A refactoring done in odoo here odoo/odoo@3654465 which breaks server_env because the partial method cannot be inspected https://github.com/OCA/server-env/blob/14.0/server_environment/models/server_env_mixin.py#L335

Error:

2023-04-04 06:33:21,973 895 CRITICAL odoo odoo.service.server: Failed to initialize database `odoo`. 
Traceback (most recent call last):
  File "/opt/odoo/odoo/tools/convert.py", line 677, in _tag_root
    f(rec)
  File "/opt/odoo/odoo/tools/convert.py", line 580, in _tag_record
    record = model._load_records([data], self.mode == 'update')
  File "/opt/odoo/odoo/models.py", line 4241, in _load_records
    records = self._load_records_create([data['values'] for data in to_create])
  File "/opt/odoo/odoo/models.py", line 4157, in _load_records_create
    return self.create(values)
  File "<decorator-gen-119>", line 2, in create
  File "/opt/odoo/odoo/api.py", line 348, in _model_create_multi
    return create(self, arg)
  File "/opt/odoo-venv/lib/python3.6/site-packages/odoo/addons/component_event/models/base.py", line 102, in create
    records = super(Base, self).create(vals_list)
  File "<decorator-gen-64>", line 2, in create
  File "/opt/odoo/odoo/api.py", line 348, in _model_create_multi
    return create(self, arg)
  File "/opt/odoo/odoo/addons/base/models/ir_fields.py", line 534, in create
    recs = super().create(vals_list)
  File "<decorator-gen-13>", line 2, in create
  File "/opt/odoo/odoo/api.py", line 348, in _model_create_multi
    return create(self, arg)
  File "/opt/odoo/odoo/models.py", line 3919, in create
    fields[0].determine_inverse(batch_recs)
  File "/opt/odoo/odoo/fields.py", line 1207, in determine_inverse
    determine(self.inverse, records)
  File "/opt/odoo/odoo/fields.py", line 81, in determine
    if needle.__name__.find('__'):
AttributeError: 'functools.partial' object has no attribute '__name__'

Issue reported odoo/odoo#117559

@simahawk
Copy link
Author

simahawk commented Apr 4, 2023

I'm working on a fix

simahawk added a commit to camptocamp/server-env that referenced this issue Apr 4, 2023
odoo.fields.determine requires inverse methods to have __name__ attribute.
    Unfortunately with partialmethod this attribute is not propagated
    even by using functools.update_wrapper.

    Introduced by odoo/odoo@3654465
rven pushed a commit to rven/server-env that referenced this issue Apr 4, 2023
``odoo.fields.determine`` requires inverse methods to have ``__name__`` attribute.
Unfortunately with ``partialmethod`` this attribute is not propagated
even by using ``functools.update_wrapper``.
In any case, `update_wrapper` would propagate the wrapped func name
which is not the same here.

Introduced by odoo/odoo@3654465
rven pushed a commit to rven/server-env that referenced this issue Apr 4, 2023
``odoo.fields.determine`` requires inverse methods to have ``__name__`` attribute.
Unfortunately with ``partialmethod`` this attribute is not propagated
even by using ``functools.update_wrapper``.
In any case, `update_wrapper` would propagate the wrapped func name
which is not the same here.

Introduced by odoo/odoo@3654465
Ricardoalso pushed a commit to camptocamp/server-env that referenced this issue Oct 6, 2023
``odoo.fields.determine`` requires inverse methods to have ``__name__`` attribute.
Unfortunately with ``partialmethod`` this attribute is not propagated
even by using ``functools.update_wrapper``.
In any case, `update_wrapper` would propagate the wrapped func name
which is not the same here.

Introduced by odoo/odoo@3654465
moitabenfdz pushed a commit to DynAppsNV/server-env that referenced this issue Nov 13, 2023
``odoo.fields.determine`` requires inverse methods to have ``__name__`` attribute.
Unfortunately with ``partialmethod`` this attribute is not propagated
even by using ``functools.update_wrapper``.
In any case, `update_wrapper` would propagate the wrapped func name
which is not the same here.

Introduced by odoo/odoo@3654465
thienvh332 pushed a commit to thienvh332/server-env that referenced this issue Sep 20, 2024
``odoo.fields.determine`` requires inverse methods to have ``__name__`` attribute.
Unfortunately with ``partialmethod`` this attribute is not propagated
even by using ``functools.update_wrapper``.
In any case, `update_wrapper` would propagate the wrapped func name
which is not the same here.

Introduced by odoo/odoo@3654465
thienvh332 pushed a commit to thienvh332/server-env that referenced this issue Sep 24, 2024
``odoo.fields.determine`` requires inverse methods to have ``__name__`` attribute.
Unfortunately with ``partialmethod`` this attribute is not propagated
even by using ``functools.update_wrapper``.
In any case, `update_wrapper` would propagate the wrapped func name
which is not the same here.

Introduced by odoo/odoo@3654465
sbidoul pushed a commit that referenced this issue Sep 30, 2024
``odoo.fields.determine`` requires inverse methods to have ``__name__`` attribute.
Unfortunately with ``partialmethod`` this attribute is not propagated
even by using ``functools.update_wrapper``.
In any case, `update_wrapper` would propagate the wrapped func name
which is not the same here.

Introduced by odoo/odoo@3654465
chaule97 pushed a commit to chaule97/server-env that referenced this issue Oct 1, 2024
``odoo.fields.determine`` requires inverse methods to have ``__name__`` attribute.
Unfortunately with ``partialmethod`` this attribute is not propagated
even by using ``functools.update_wrapper``.
In any case, `update_wrapper` would propagate the wrapped func name
which is not the same here.

Introduced by odoo/odoo@3654465
chaule97 pushed a commit to chaule97/server-env that referenced this issue Oct 1, 2024
``odoo.fields.determine`` requires inverse methods to have ``__name__`` attribute.
Unfortunately with ``partialmethod`` this attribute is not propagated
even by using ``functools.update_wrapper``.
In any case, `update_wrapper` would propagate the wrapped func name
which is not the same here.

Introduced by odoo/odoo@3654465
chaule97 pushed a commit to chaule97/server-env that referenced this issue Oct 1, 2024
``odoo.fields.determine`` requires inverse methods to have ``__name__`` attribute.
Unfortunately with ``partialmethod`` this attribute is not propagated
even by using ``functools.update_wrapper``.
In any case, `update_wrapper` would propagate the wrapped func name
which is not the same here.

Introduced by odoo/odoo@3654465
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

1 participant