0

I created a custom module, and installed in my Odoo 15 session, after some changes, I tried to update it, but I get the following error message,

How to fix it please? Thanks,

    **RPC_ERROR**
    Odoo Server Error
    Traceback (most recent call last):
    File "C:\Program Files\Odoo15\server\odoo\addons\base\models\ir_http.py", line 237, in _dispatch
    result = request.dispatch()
    File "C:\Program Files\Odoo15\server\odoo\http.py", line 688, in dispatch
    result = self._call_function(**self.params)
    File "C:\Program Files\Odoo15\server\odoo\http.py", line 360, in _call_function
    return checked_call(self.db, *args, **kwargs)
    File "C:\Program Files\Odoo15\server\odoo\service\model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
    File "C:\Program Files\Odoo15\server\odoo\http.py", line 349, in checked_call
    result = self.endpoint(*a, **kw)
    File "C:\Program Files\Odoo15\server\odoo\http.py", line 917, in __call__
    return self.method(*args, **kw)
    File "C:\Program Files\Odoo15\server\odoo\http.py", line 536, in response_wrap
    response = f(*args, **kw)
    File "C:\Program Files\Odoo15\server\odoo\addons\web\controllers\main.py", line 1339, in call_button
    action = self._call_kw(model, method, args, kwargs)
    File "C:\Program Files\Odoo15\server\odoo\addons\web\controllers\main.py", line 1327, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
    File "C:\Program Files\Odoo15\server\odoo\api.py", line 464, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
    File "C:\Program Files\Odoo15\server\odoo\api.py", line 451, in _call_kw_multi
    result = method(recs, *args, **kwargs)
    File "", line 2, in button_immediate_upgrade
    File "C:\Program Files\Odoo15\server\odoo\addons\base\models\ir_module.py", line 74, in check_and_log
    return method(self, *args, **kwargs)
    File "C:\Program Files\Odoo15\server\odoo\addons\base\models\ir_module.py", line 662, in button_immediate_upgrade
    return self._button_immediate_function(type(self).button_upgrade)
    File "C:\Program Files\Odoo15\server\odoo\addons\base\models\ir_module.py", line 600, in _button_immediate_function
    registry = modules.registry.Registry.new(self._cr.dbname, update_module=True)
    File "C:\Program Files\Odoo15\server\odoo\modules\registry.py", line 87, in new
    odoo.modules.load_modules(registry, force_demo, status, update_module)
    File "C:\Program Files\Odoo15\server\odoo\modules\loading.py", line 513, in load_modules
    env['ir.model.data']._process_end(processed_modules)
    File "C:\Program Files\Odoo15\server\odoo\addons\base\models\ir_model.py", line 2269, in _process_end
    self._process_end_unlink_record(record)
    File "C:\Program Files\Odoo15\server\odoo\addons\website\models\ir_model_data.py", line 36, in _process_end_unlink_record
    return super()._process_end_unlink_record(record)
    File "C:\Program Files\Odoo15\server\odoo\addons\base\models\ir_model.py", line 2198, in _process_end_unlink_record
    record.unlink()
    File "C:\Program Files\Odoo15\server\odoo\addons\base\models\ir_model.py", line 1375, in unlink
    self._process_ondelete()
    File "C:\Program Files\Odoo15\server\odoo\addons\base\models\ir_model.py", line 1423, in _process_ondelete
    ondelete = (field.ondelete or {}).get(selection.value)
    Exception
    
    The above exception was the direct cause of the following exception:
    Traceback (most recent call last):
    File "C:\Program Files\Odoo15\server\odoo\http.py", line 644, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
    File "C:\Program Files\Odoo15\server\odoo\http.py", line 302, in _handle_exception
    raise exception.with_traceback(None) from new_cause
    AttributeError: 'str' object has no attribute 'get'

4

1 回答 1

0

您似乎有一个带有 ondelete 参数的选择字段作为字符串,这对于选择字段 ondelete 应该是字典是错误的

例子

my_selection = fields.Selection([
    ('val_1', "Value 1"),
    ('val_2', "Value 2"),
], ondelete={'val_1': 'set default', 'val_1':'set default'})
于 2022-01-31T11:54:20.453 回答