Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
21959 Lượt xem

Module install fine, however when I update the module it get this error:

AttributeError: 'NoneType' object has no attribute '_fields'

A bit of background, I am trying to make a bespoke quote module and have been using the sales module as a reference point. I have narrowed down the issue to the field:

tax_id = fields.Many2many('account.tax', string='Taxes', domain=['|', ('active', '=', False), ('active', '=', True)])

But I just can't figure out the reason behind the error.

Full Log

Error:

Odoo Server Error

Traceback (most recent call last):
File "/odoo/odoo-server/odoo/http.py", line 653, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/odoo/odoo-server/odoo/http.py", line 312, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/odoo/odoo-server/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/odoo/odoo-server/odoo/http.py", line 695, in dispatch
result = self._call_function(**self.params)
File "/odoo/odoo-server/odoo/http.py", line 344, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/odoo/odoo-server/odoo/service/model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "/odoo/odoo-server/odoo/http.py", line 337, in checked_call
result = self.endpoint(*a, **kw)
File "/odoo/odoo-server/odoo/http.py", line 939, in __call__
return self.method(*args, **kw)
File "/odoo/odoo-server/odoo/http.py", line 517, in response_wrap
response = f(*args, **kw)
File "/odoo/odoo-server/addons/web/controllers/main.py", line 938, in call_button
action = self._call_kw(model, method, args, {})
File "/odoo/odoo-server/addons/web/controllers/main.py", line 926, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/odoo/odoo-server/odoo/api.py", line 689, in call_kw
return call_kw_multi(method, model, args, kwargs)
File "/odoo/odoo-server/odoo/api.py", line 680, in call_kw_multi
result = method(recs, *args, **kwargs)
File "</usr/local/lib/python3.6/dist-packages/decorator.py:decorator-gen-48>", line 2, in button_immediate_upgrade
File "/odoo/odoo-server/odoo/addons/base/module/module.py", line 72, in check_and_log
return method(self, *args, **kwargs)
File "/odoo/odoo-server/odoo/addons/base/module/module.py", line 613, in button_immediate_upgrade
return self._button_immediate_function(type(self).button_upgrade)
File "/odoo/odoo-server/odoo/addons/base/module/module.py", line 552, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "/odoo/odoo-server/odoo/modules/registry.py", line 85, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/odoo/odoo-server/odoo/modules/loading.py", line 376, in load_modules
force, status, report, loaded_modules, update_module, models_to_check)
File "/odoo/odoo-server/odoo/modules/loading.py", line 274, in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check
File "/odoo/odoo-server/odoo/modules/loading.py", line 152, in load_module_graph
registry.setup_models(cr)
File "/odoo/odoo-server/odoo/modules/registry.py", line 280, in setup_models
model._setup_complete()
File "/odoo/odoo-server/odoo/models.py", line 2464, in _setup_complete
field.setup_triggers(self)
File "/odoo/odoo-server/odoo/fields.py", line 699, in setup_triggers
for model, field, path in self.resolve_deps(model):
File "/odoo/odoo-server/odoo/fields.py", line 677, in resolve_deps
field = model._fields[fname]
AttributeError: 'NoneType' object has no attribute '_fields'
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

The model variable is not getting set (None). 

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 5 18
6280
1
thg 6 25
5203
3
thg 7 20
11909
4
thg 10 24
5377
0
thg 9 17
4046