OCA / server-env

Tools to manage environment-dependent configuration
GNU Affero General Public License v3.0
57 stars 162 forks source link

server_env_mixin broken: on 14.0 + 15.0 + 16.0 #151

Closed simahawk closed 1 year ago

simahawk commented 1 year ago

A refactoring done in odoo here https://github.com/odoo/odoo/commit/36544651f2049bcf18777091dbf02c9631b33243 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 https://github.com/odoo/odoo/issues/117559

simahawk commented 1 year ago

I'm working on a fix