AttributeError: '_unknown' object has no attribute 'id' - in Odoo 15 - python

I added a custom field res.patner, this field in Char data type, now I want to add it on account.move by the code below.
class InvoicingMove(models.Model):
_inherit = 'account.move'
patient_medical_aid_number_id = fields.Many2one('partner_id.member_medical_aid_number', string='Patient Medical Aid Number', readonly=True)
But when I try to open up an invoice i get:
Traceback (most recent call last):
File "C:\Program Files\Odoo\15\server\odoo\addons\base\models\ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "C:\Program Files\Odoo\15\server\odoo\http.py", line 688, in dispatch
result = self._call_function(**self.params)
File "C:\Program Files\Odoo\15\server\odoo\http.py", line 360, in _call_function
return checked_call(self.db, *args, **kwargs)
File "C:\Program Files\Odoo\15\server\odoo\service\model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "C:\Program Files\Odoo\15\server\odoo\http.py", line 349, in checked_call
result = self.endpoint(*a, **kw)
File "C:\Program Files\Odoo\15\server\odoo\http.py", line 917, in __call__
return self.method(*args, **kw)
File "C:\Program Files\Odoo\15\server\odoo\http.py", line 536, in response_wrap
response = f(*args, **kw)
File "C:\Program Files\Odoo\15\server\odoo\addons\web\controllers\main.py", line 1348, in call_kw
return self._call_kw(model, method, args, kwargs)
File "C:\Program Files\Odoo\15\server\odoo\addons\web\controllers\main.py", line 1340, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "C:\Program Files\Odoo\15\server\odoo\api.py", line 464, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "C:\Program Files\Odoo\15\server\odoo\api.py", line 451, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "C:\Program Files\Odoo\15\server\odoo\models.py", line 3227, in read
return self._read_format(fnames=fields, load=load)
File "C:\Program Files\Odoo\15\server\odoo\models.py", line 3247, in _read_format
vals[name] = convert(record[name], record, use_name_get)
File "C:\Program Files\Odoo\15\server\odoo\fields.py", line 2813, in convert_to_read
return value.id
Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Program Files\Odoo\15\server\odoo\http.py", line 644, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "C:\Program Files\Odoo\15\server\odoo\http.py", line 302, in _handle_exception
raise exception.with_traceback(None) from new_cause
AttributeError: '_unknown' object has no attribute 'id'

The first parameter (partner_id.member_medical_aid_number) will be used as the comodel_name and when Odoo will try to set up the field, it will check if the comodel name is loaded and if not it will set it to _unknown
You should see the following warning in the log:
Field account.move.patient_medical_aid_number_id with unknown comodel_name 'partner_id.member_medical_aid_number'
If you want to use a related field, set the related attribute and use the same field type
Example:
patient_medical_aid_number_id = fields.Char(related='partner_id.member_medical_aid_number', string='Patient Medical Aid Number', readonly=True)

Related

Server error when updating custom module fromOdoo-10 to Odoo-15

I'm trying to update custom module from Odoo v10 to v15.
When I try to install module I get following error:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/tools/cache.py", line 85, in lookup
r = d[key]
File "/usr/lib/python3/dist-packages/odoo/tools/func.py", line 71, in wrapper
return func(self, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/tools/lru.py", line 34, in __getitem__
a = self.d[obj]
KeyError: ('ir.model.data', <function IrModelData._xmlid_lookup at 0x7f93db198a60>, 'web.assets_backend')
During handling of the above exception, another exception occurred:
Traceback (most recAent call last):
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 680, in _tag_root
f(rec)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 658, in _tag_template
return self._tag_record(record)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 567, in _tag_record
f_val = self.id_get(f_ref)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 663, in id_get
res = self.model_id_get(id_str, raise_if_not_found)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 669, in model_id_get
return self.env['ir.model.data']._xmlid_to_res_model_res_id(id_str, raise_if_not_found=raise_if_not_found)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_model.py", line 1943, in _xmlid_to_res_model_res_id
return self._xmlid_lookup(xmlid)[1:3]
File "<decorator-gen-35>", line 2, in _xmlid_lookup
File "/usr/lib/python3/dist-packages/odoo/tools/cache.py", line 90, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_model.py", line 1936, in _xmlid_lookup
raise ValueError('External ID not found in the system: %s' % xmlid)
ValueError: External ID not found in the system: web.assets_backend
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/usr/lib/python3/dist-packages/odoo/http.py", line 687, in dispatch
result = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 359, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 348, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 916, in __call__
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 535, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1347, in call_button
action = self._call_kw(model, method, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1335, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 464, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 451, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "<decorator-gen-74>", line 2, in button_immediate_install
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 74, in check_and_log
return method(self, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 483, in button_immediate_install
return self._button_immediate_function(type(self).button_install)
File "/usr/lib/python3/dist-packages/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 "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 87, in new
odoo.modules.load_modules(registry, force_demo, status, update_module)
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 474, in load_modules
processed_modules += load_marked_modules(cr, graph,
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 363, in load_marked_modules
loaded, processed = load_module_graph(
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 222, in load_module_graph
load_data(cr, idref, mode, kind='data', package=package)
File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 69, in load_data
tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 745, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 811, in convert_xml_import
obj.parse(doc.getroot())
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 731, in parse
self._tag_root(de)
File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 693, in _tag_root
raise ParseError('while parsing %s:%s, somewhere inside\n%s' % (
Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 643, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 301, in _handle_exception
raise exception.with_traceback(None) from new_cause
odoo.tools.convert.ParseError: while parsing None:4, somewhere inside
<data name="web_timeline assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/web_timeline/static/lib/vis/vis-timeline-graph2d.min.css"/>
<link rel="stylesheet" href="/web_timeline/static/src/css/web_timeline.css"/>
<script type="text/javascript" src="/web_timeline/static/lib/vis/vis-timeline-graph2d.min.js"/>
<script type="text/javascript" src="/web_timeline/static/src/js/web_timeline.js"/>
</xpath>
</data>
I have added in manifest file following code but it didn't help:
'assets': {
'web.assets_backend': [
'web_timeline/static/src/js/web_timeline.js',
],
'web.assets_common': [
'web_timeline/static/lib/vis/vis-timeline-graph2d.min.css',
'web_timeline/static/src/css/web_timeline.css',
'web_timeline/static/lib/vis/vis-timeline-graph2d.min.js',
]
}
I'm new to Odoo and can't figure out this error stack, I thought those js files had to be put in assets bundle.
Any help would be appreciated, thank you.
From v15, Odoo removed the support of pushing assets using the view web.assets_backend , web.assets_frontend etc.
So, you're right importing those files through the manifest, but you should still remove the call to the view that extends web.assets_backend etc.
You can try by simply commenting out the call to that view (e.g. views/assets.xml or something? :) ) in the manifest.
Keep me updated if you need more help

How to relation two field from differents models in Odoo or OpenERP?

I want to know how to relation 2 CHAR Fields by code in Odoo.
First field is in product.template the HS CODE and the other one is in account.invoice.line and is a custom field.
How can I do this?
I have this error message
Error:
Odoo Server Error
Traceback (most recent call last):
File "/home/ubuntu/OdooAddons/odoo/odoo/http.py", line 656, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/ubuntu/OdooAddons/odoo/odoo/http.py", line 314, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/home/ubuntu/OdooAddons/odoo/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/home/ubuntu/OdooAddons/odoo/odoo/http.py", line 698, in dispatch
result = self._call_function(**self.params)
File "/home/ubuntu/OdooAddons/odoo/odoo/http.py", line 346, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/ubuntu/OdooAddons/odoo/odoo/service/model.py", line 98, in wrapper
return f(dbname, *args, **kwargs)
File "/home/ubuntu/OdooAddons/odoo/odoo/http.py", line 339, in checked_call
result = self.endpoint(*a, **kw)
File "/home/ubuntu/OdooAddons/odoo/odoo/http.py", line 941, in __call__
return self.method(*args, **kw)
File "/home/ubuntu/OdooAddons/odoo/odoo/http.py", line 519, in response_wrap
response = f(*args, **kw)
File "/home/ubuntu/OdooAddons/odoo/addons/web/controllers/main.py", line 967, in call_button
action = self._call_kw(model, method, args, {})
File "/home/ubuntu/OdooAddons/odoo/addons/web/controllers/main.py", line 955, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/home/ubuntu/OdooAddons/odoo/odoo/api.py", line 759, in call_kw
return _call_kw_multi(method, model, args, kwargs)
File "/home/ubuntu/OdooAddons/odoo/odoo/api.py", line 746, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "<decorator-gen-67>", line 2, in button_immediate_upgrade
File "/home/ubuntu/OdooAddons/odoo/odoo/addons/base/models/ir_module.py", line 74, in check_and_log
return method(self, *args, **kwargs)
File "/home/ubuntu/OdooAddons/odoo/odoo/addons/base/models/ir_module.py", line 627, in button_immediate_upgrade
return self._button_immediate_function(type(self).button_upgrade)
File "/home/ubuntu/OdooAddons/odoo/odoo/addons/base/models/ir_module.py", line 561, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "/home/ubuntu/OdooAddons/odoo/odoo/modules/registry.py", line 86, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/home/ubuntu/OdooAddons/odoo/odoo/modules/loading.py", line 417, in load_modules
force, status, report, loaded_modules, update_module, models_to_check)
File "/home/ubuntu/OdooAddons/odoo/odoo/modules/loading.py", line 313, in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check
File "/home/ubuntu/OdooAddons/odoo/odoo/modules/loading.py", line 194, in load_module_graph
registry.setup_models(cr)
File "/home/ubuntu/OdooAddons/odoo/odoo/modules/registry.py", line 275, in setup_models
model._setup_fields()
File "/home/ubuntu/OdooAddons/odoo/odoo/models.py", line 2656, in _setup_fields
field.setup_full(self)
File "/home/ubuntu/OdooAddons/odoo/odoo/fields.py", line 520, in setup_full
self._setup_related_full(model)
File "/home/ubuntu/OdooAddons/odoo/odoo/fields.py", line 563, in _setup_related_full
field = target._fields[name]
KeyError: 'hs_code'
Thanks
The solution was to add the delivery_hs_code module to the depends entry in the manifest file.
Thank you Kenly

Can't install own custom modules in Odoo 13

During the last two days I have been trying to install a custom module in Odoo 13. I got the same error over and over again, telling that a column didn't exist in the model that I was creating (the variable in the class did, indeed, exist), I show the error down below.
The python code of the module is the following:
from odoo import models, fields, api
class OfferStage(models.Model):
_name = 'offer.stage'
_description = 'Offer stage'
name = fields.Char()
revisable = fields.Boolean()
sequence = fields.Integer()
modificable = fields.Boolean()
notify_jefe = fields.Boolean()
fold = fields.Boolean()
convertible = fields.Boolean()
notify_personal = fields.Boolean()
notify_jefe_area = fields.Boolean()
And the error I get:
Error:
Odoo Server Error
Traceback (most recent call last):
File "/opt/odoo/odoo/odoo/http.py", line 624, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/odoo/odoo/http.py", line 310, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/opt/odoo/odoo/odoo/tools/pycompat.py", line 14, in reraise
raise value
File "/opt/odoo/odoo/odoo/http.py", line 669, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo/odoo/odoo/http.py", line 350, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo/odoo/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo/odoo/odoo/http.py", line 339, in checked_call
result = self.endpoint(*a, **kw)
File "/opt/odoo/odoo/odoo/http.py", line 915, in __call__
return self.method(*args, **kw)
File "/opt/odoo/odoo/odoo/http.py", line 515, in response_wrap
response = f(*args, **kw)
File "/opt/odoo/odoo/addons/web/controllers/main.py", line 1331, in call_button
action = self._call_kw(model, method, args, kwargs)
File "/opt/odoo/odoo/addons/web/controllers/main.py", line 1319, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/opt/odoo/odoo/odoo/api.py", line 387, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/opt/odoo/odoo/odoo/api.py", line 374, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "<decorator-gen-60>", line 2, in button_immediate_install
File "/opt/odoo/odoo/odoo/addons/base/models/ir_module.py", line 72, in check_and_log
return method(self, *args, **kwargs)
File "/opt/odoo/odoo/odoo/addons/base/models/ir_module.py", line 463, in button_immediate_install
return self._button_immediate_function(type(self).button_install)
File "/opt/odoo/odoo/odoo/addons/base/models/ir_module.py", line 573, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "/opt/odoo/odoo/odoo/modules/registry.py", line 86, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/opt/odoo/odoo/odoo/modules/loading.py", line 421, in load_modules
processed_modules += load_marked_modules(cr, graph,
File "/opt/odoo/odoo/odoo/modules/loading.py", line 313, in load_marked_modules
loaded, processed = load_module_graph(
File "/opt/odoo/odoo/odoo/modules/loading.py", line 202, in load_module_graph
registry.init_models(cr, model_names, {'module': package.name}, new_install)
File "/opt/odoo/odoo/odoo/modules/registry.py", line 369, in init_models
model._auto_init()
File "/opt/odoo/odoo/odoo/models.py", line 2529, in _auto_init
new = field.update_db(self, columns)
File "/opt/odoo/odoo/odoo/fields.py", line 857, in update_db
self.update_db_notnull(model, column)
File "/opt/odoo/odoo/odoo/fields.py", line 921, in update_db_notnull
sql.drop_not_null(model._cr, model._table, self.name)
File "/opt/odoo/odoo/odoo/tools/sql.py", line 119, in drop_not_null
cr.execute('ALTER TABLE "{}" ALTER COLUMN "{}" DROP NOT NULL'.format(tablename, columnname))
File "/opt/odoo/odoo/odoo/sql_db.py", line 173, in wrapper
return f(self, *args, **kwargs)
File "/opt/odoo/odoo/odoo/sql_db.py", line 250, in execute
res = self._obj.execute(query, params)
psycopg2.errors.UndefinedColumn: column "name" of relation "offer_stage" does not exist
After some trial and error, I tried to install a default module that is created with odoo-bin scaffold, and what was my surprise when I cound't install it neither.
The error I get when installing the default module is a collision with other tables of odoo packages, since I am in a test environment I tried removing those packages and, when trying to reinstall, the same error arose but with a different package. I can't figure out why this happens because, a priori, my package only depends on 'base'.
The code of the default module created with scaffold:
# -*- coding: utf-8 -*-
from odoo import models, fields, api
class borrar(models.Model):
_name = 'borrar.borrar'
_description = 'borrar.borrar'
name = fields.Char()
value = fields.Integer()
value2 = fields.Float(compute="_value_pc", store=True)
description = fields.Text()
#api.depends('value')
def _value_pc(self):
for record in self:
record.value2 = float(record.value) / 100
The error I get:
Error:
Odoo Server Error
Traceback (most recent call last):
File "/opt/odoo/odoo/odoo/http.py", line 624, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/odoo/odoo/http.py", line 310, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/opt/odoo/odoo/odoo/tools/pycompat.py", line 14, in reraise
raise value
File "/opt/odoo/odoo/odoo/http.py", line 669, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo/odoo/odoo/http.py", line 350, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo/odoo/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo/odoo/odoo/http.py", line 339, in checked_call
result = self.endpoint(*a, **kw)
File "/opt/odoo/odoo/odoo/http.py", line 915, in __call__
return self.method(*args, **kw)
File "/opt/odoo/odoo/odoo/http.py", line 515, in response_wrap
response = f(*args, **kw)
File "/opt/odoo/odoo/addons/web/controllers/main.py", line 1331, in call_button
action = self._call_kw(model, method, args, kwargs)
File "/opt/odoo/odoo/addons/web/controllers/main.py", line 1319, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/opt/odoo/odoo/odoo/api.py", line 387, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/opt/odoo/odoo/odoo/api.py", line 374, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "<decorator-gen-60>", line 2, in button_immediate_install
File "/opt/odoo/odoo/odoo/addons/base/models/ir_module.py", line 72, in check_and_log
return method(self, *args, **kwargs)
File "/opt/odoo/odoo/odoo/addons/base/models/ir_module.py", line 463, in button_immediate_install
return self._button_immediate_function(type(self).button_install)
File "/opt/odoo/odoo/odoo/addons/base/models/ir_module.py", line 573, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "/opt/odoo/odoo/odoo/modules/registry.py", line 86, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/opt/odoo/odoo/odoo/modules/loading.py", line 467, in load_modules
env[model]._check_removed_columns(log=True)
File "/opt/odoo/odoo/odoo/models.py", line 2447, in _check_removed_columns
tools.drop_not_null(cr, self._table, row['attname'])
File "/opt/odoo/odoo/odoo/tools/sql.py", line 119, in drop_not_null
cr.execute('ALTER TABLE "{}" ALTER COLUMN "{}" DROP NOT NULL'.format(tablename, columnname))
File "/opt/odoo/odoo/odoo/sql_db.py", line 173, in wrapper
return f(self, *args, **kwargs)
File "/opt/odoo/odoo/odoo/sql_db.py", line 250, in execute
res = self._obj.execute(query, params)
psycopg2.errors.UndefinedColumn: column "rows" of relation "product_packaging" does not exist
However, the table borrar_borrar does get created:
link to image showing table in pgadmin4
This only happens with modules created by me, I have downloaded several modules from github and the official Odoo store and all of them install flawlessly.
Note: for ease of maintenance I have the modules in a git repository and I have soft-linked them to the custom-addons folder in the odoo directory. I have also tried placing them directly in the directory and the errors are the same.
I found out the solution. I'm writing it here in case someone face the same problem in the future.
The issue was that I had a Foreign Data Wrapper (FDW) to read data from another database and, for some reason, it was causing some kind of interference with the database I was working on. When I removed the FDW, everything worked as expected.

Char field related KeyError 'work_location'

I'm working with employee data such as in python:
employee_id = fields.Many2one('hr.employee', string="Работник")
work_location = fields.Char(related='employee_id.work_location', string="Место трудоустройства")
in xml
<field name="work_location"/>
when I uninstal and then install module it's ok but when i change somesing even in xml and try to update module I have an error
Odoo Server Error
Traceback (most recent call last):
File "/opt/odoo13/odoo/odoo/http.py", line 619, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo13/odoo/odoo/http.py", line 309, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/opt/odoo13/odoo/odoo/tools/pycompat.py", line 14, in reraise
raise value
File "/opt/odoo13/odoo/odoo/http.py", line 664, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo13/odoo/odoo/http.py", line 345, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo13/odoo/odoo/service/model.py", line 93, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo13/odoo/odoo/http.py", line 338, in checked_call
result = self.endpoint(*a, **kw)
File "/opt/odoo13/odoo/odoo/http.py", line 909, in __call__
return self.method(*args, **kw)
File "/opt/odoo13/odoo/odoo/http.py", line 510, in response_wrap
response = f(*args, **kw)
File "/opt/odoo13/odoo/addons/web/controllers/main.py", line 1323, in call_button
action = self._call_kw(model, method, args, kwargs)
File "/opt/odoo13/odoo/addons/web/controllers/main.py", line 1311, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/opt/odoo13/odoo/odoo/api.py", line 395, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/opt/odoo13/odoo/odoo/api.py", line 382, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "<decorator-gen-64>", line 2, in button_immediate_upgrade
File "/opt/odoo13/odoo/odoo/addons/base/models/ir_module.py", line 72, in check_and_log
return method(self, *args, **kwargs)
File "/opt/odoo13/odoo/odoo/addons/base/models/ir_module.py", line 629, in button_immediate_upgrade
return self._button_immediate_function(type(self).button_upgrade)
File "/opt/odoo13/odoo/odoo/addons/base/models/ir_module.py", line 573, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "/opt/odoo13/odoo/odoo/modules/registry.py", line 85, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/opt/odoo13/odoo/odoo/modules/loading.py", line 416, in load_modules
force, status, report, loaded_modules, update_module, models_to_check)
File "/opt/odoo13/odoo/odoo/modules/loading.py", line 312, in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check
File "/opt/odoo13/odoo/odoo/modules/loading.py", line 194, in load_module_graph
registry.setup_models(cr)
File "/opt/odoo13/odoo/odoo/modules/registry.py", line 247, in setup_models
model._setup_fields()
File "/opt/odoo13/odoo/odoo/models.py", line 2675, in _setup_fields
field.setup_full(self)
File "/opt/odoo13/odoo/odoo/fields.py", line 405, in setup_full
self._setup_related_full(model)
File "/opt/odoo13/odoo/odoo/fields.py", line 458, in _setup_related_full
field = target._fields[name]
KeyError: 'work_location'
I dont use work_location anywhere else. I can't get what I did wrong. (sorry for bad english)
It seems use of dependency module is missing in your custom module manifest file. Make sure you have added hr module in it. Like
'depends': ['hr']

ProgrammingError: relation "hr_expense_id_seq" does not exist. Odoo 10.0

When trying to validate or submit a new EXPENSE in odoo version 10.0, i get the following Error.
This thread is expressed in Odoo Forum
Traceback (most recent call last):
File "/home/gloxon/odoo/http.py", line 642, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/gloxon/odoo/http.py", line 684, in dispatch
result = self._call_function(**self.params)
File "/home/gloxon/odoo/http.py", line 334, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/gloxon/odoo/service/model.py", line 101, in wrapper
return f(dbname, *args, **kwargs)
File "/home/gloxon/odoo/http.py", line 327, in checked_call
result = self.endpoint(*a, **kw)
File "/home/gloxon/odoo/http.py", line 942, in __call__
return self.method(*args, **kw)
File "/home/gloxon/odoo/http.py", line 507, in response_wrap
response = f(*args, **kw)
File "/home/gloxon/addons/web/controllers/main.py", line 892, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/home/gloxon/addons/web/controllers/main.py", line 884, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/home/gloxon/odoo/api.py", line 687, in call_kw
return call_kw_model(method, model, args, kwargs)
File "/home/gloxon/odoo/api.py", line 672, in call_kw_model
result = method(recs, *args, **kwargs)
File "/home/gloxon/addons/mail/models/mail_thread.py", line 228, in create
thread = super(MailThread, self).create(values)
File "/home/gloxon/odoo/models.py", line 3847, in create
record = self.browse(self._create(old_vals))
File "/home/gloxon/odoo/models.py", line 3942, in _create
cr.execute(query, tuple(u[2] for u in updates if len(u) > 2))
File "/home/gloxon/odoo/sql_db.py", line 154, in wrapper
return f(self, *args, **kwargs)
File "/home/gloxon/odoo/sql_db.py", line 231, in execute
res = self._obj.execute(query, params)
ProgrammingError: relation "hr_expense_id_seq" does not exist
LINE 1: ...uid", "create_date", "write_date") VALUES(nextval('hr_expens...
I don't know what to do in other to fix this.
I had a similar case of a missing sequence with Odoo 12 CE. It turned out that I was restoring a database dump from Postgres 10.10 into a Postgres 9.6 and they don't like each other.
The solution was to install Postgres 10.10, restore the database there and restart Odoo.

Categories