Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

"AttributeError: '_unknown' object has no attribute 'id'"

Naroči se

Get notified when there's activity on this post

This question has been flagged
many2oneone2manyPythonv15
1 Odgovori
6048 Prikazi
Avatar
Devin Gardner

We have two custom modules written for Odoo 15, each with their own models. To make things simple and avoid sharing too much information, we'll call them process and tank. A process can have many tanks, but a tank can only have one process. I used a Many2one and One2many field relationship between tanks and processes, and I've shown the field definition lines for each file below.

Whenever I upgrade either the tank parent module or process parent module, I get the error shown below, up until I push literally any commit to Odoo.sh involving the models' definition files. The error example shown below comes from the process parent module. I upgrade the module, and then get this error until I push ANY commit to Odoo.sh (which forces a reload in our case) involving the process.py file. I'm not quite sure of the root cause of the issue, and I've spent about 2 weeks off and on Googling and trying to solve this weird issue. The bandaid fix is enough for development environments, but this application goes live soon so I'd like to get it taken care of.

This is the field definition line from the process.py file. The model name is process:

tank_ids = fields.One2many('tank', 'process_id')

This is the field definition line from the tank.py file. The model name is tank:

process_id = fields.Many2one('process', 'tank_ids')

Below is the full error traceback:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/api.py", line 886, in get
    return field_cache[record._ids[0]]
KeyError: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/fields.py", line 1082, in __get__
    value = env.cache.get(record, self)
  File "/home/odoo/src/odoo/odoo/api.py", line 889, in get
    raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: 'process(1,).total_cost'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/api.py", line 886, in get
    return field_cache[record._ids[0]]
KeyError: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/fields.py", line 1082, in __get__
    value = env.cache.get(record, self)
  File "/home/odoo/src/odoo/odoo/api.py", line 889, in get
    raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: 'process(1,).tank_ids'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
    result = request.dispatch()
  File "/home/odoo/src/odoo/odoo/http.py", line 698, in dispatch
    result = self._call_function(**self.params)
  File "/home/odoo/src/odoo/odoo/http.py", line 368, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/home/odoo/src/odoo/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/home/odoo/src/odoo/odoo/http.py", line 357, in checked_call
    result = self.endpoint(*a, **kw)
  File "/home/odoo/src/odoo/odoo/http.py", line 921, in __call__
    return self.method(*args, **kw)
  File "/home/odoo/src/odoo/odoo/http.py", line 546, in response_wrap
    response = f(*args, **kw)
  File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1282, in search_read
    return self.do_search_read(model, fields, offset, limit, domain, sort)
  File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1301, in do_search_read
    return Model.web_search_read(domain, fields, offset=offset, limit=limit, order=sort)
  File "/home/odoo/src/odoo/addons/web/models/models.py", line 62, in web_search_read
    records = self.search_read(domain, fields, offset=offset, limit=limit, order=order)
  File "/home/odoo/src/odoo/odoo/models.py", line 5064, in search_read
    result = records.read(fields, **read_kwargs)
  File "/home/odoo/src/odoo/odoo/models.py", line 3232, in read
    return self._read_format(fnames=fields, load=load)
  File "/home/odoo/src/odoo/odoo/models.py", line 3252, in _read_format
    vals[name] = convert(record[name], record, use_name_get)
  File "/home/odoo/src/odoo/odoo/models.py", line 5902, in __getitem__
    return self._fields[key].__get__(self, type(self))
  File "/home/odoo/src/odoo/odoo/fields.py", line 1131, in __get__
    self.compute_value(recs)
  File "/home/odoo/src/odoo/odoo/fields.py", line 1290, in compute_value
    records._compute_field_value(self)
  File "/home/odoo/src/odoo/odoo/models.py", line 4266, in _compute_field_value
    fields.determine(field.compute, self)
  File "/home/odoo/src/odoo/odoo/fields.py", line 87, in determine
    return needle(*args)
  File "/home/odoo/src/user/mixer_quoting/models/process.py", line 34, in _compute_total_cost
    if len(record.tank_ids) > 0:
  File "/home/odoo/src/odoo/odoo/fields.py", line 3402, in __get__
    return super().__get__(records, owner)
  File "/home/odoo/src/odoo/odoo/fields.py", line 2617, in __get__
    return super().__get__(records, owner)
  File "/home/odoo/src/odoo/odoo/fields.py", line 1108, in __get__
    recs._fetch_field(self)
  File "/home/odoo/src/odoo/odoo/models.py", line 3281, in _fetch_field
    self._read(fnames)
  File "/home/odoo/src/odoo/odoo/models.py", line 3385, in _read
    field.read(fetched)
  File "/home/odoo/src/odoo/odoo/fields.py", line 3419, in read
    group[get_id(line[inverse])].append(line.id)
  File "/home/odoo/src/odoo/odoo/fields.py", line 3411, in <lambda>
    get_id = (lambda rec: rec.id) if inverse_field.type == 'many2one' else int
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/http.py", line 654, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/odoo/src/odoo/odoo/http.py", line 301, in _handle_exception
    raise exception.with_traceback(None) from new_cause
AttributeError: '_unknown' object has no attribute 'id'


0
Avatar
Opusti
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

Hi,


The object has no attribute" is a common error message in programming that occurs when you try to access an attribute or method of an object that does not exist. This can happen due to a variety of reasons, such as misspelling the attribute or method name, using an incorrect data type, or not initializing the object properly. In this video topic, you could explore different scenarios where this error can occur in odoo16 and resolve this error effectively.


you can refer to this video:


 https://www.cybrosys.com/odoo/videos/technical/error-object-has-no-attribute-in-odoo-16


Hope it helps

0
Avatar
Opusti
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Send a one2many field to display it in another form on smart button click
many2one one2many formview v15
Avatar
1
dec. 22
3989
How to inherit custom module which is already inherited?
inheritance many2one one2many v15
Avatar
0
avg. 22
3712
How do I put One2many after Many2one defined? - transient module states reset
many2one one2many
Avatar
1
mar. 23
3238
Odoo Studio how to set a chain of multiple and related Many2one within a One2many lines
many2one one2many
Avatar
0
dec. 22
3840
Get the values of one2many field Solved
one2many v15
Avatar
Avatar
1
jun. 22
3100
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now