Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
3 Besvarelser
1285 Visninger

i got this error 

UncaughtPromiseError > OwlError

Uncaught Promise > An error occured in the owl lifecycle (see this Error's "cause" property)

OwlError: An error occured in the owl lifecycle (see this Error's "cause" property)

    Error: An error occured in the owl lifecycle (see this Error's "cause" property)

        at handleError (http://localhost:8069/web/assets/c42d6d9/web.assets_web.min.js:916:101)

        at App.handleError (http://localhost:8069/web/assets/c42d6d9/web.assets_web.min.js:1551:29)

        at ComponentNode.initiateRender (http://localhost:8069/web/assets/c42d6d9/web.assets_web.min.js:1007:19)


Caused by: Error: "res.company"."custom_field" field is undefined.

    at Field.parseFieldNode (http://localhost:8069/web/assets/c42d6d9/web.assets_web.min.js:7711:231)

    at http://localhost:8069/web/assets/c42d6d9/web.assets_web.min.js:8586:865

    at visit (http://localhost:8069/web/assets/c42d6d9/web.assets_web.min.js:4251:51)

    at visitChildren (http://localhost:8069/web/assets/c42d6d9/web.assets_web.min.js:4250:171)

    at visit (http://localhost:8069/web/assets/c42d6d9/web.assets_web.min.js:4251:129)

    at visitChildren (http://localhost:8069/web/assets/c42d6d9/web.assets_web.min.js:4250:171)

    at visit (http://localhost:8069/web/assets/c42d6d9/web.assets_web.min.js:4251:129)

    at visitChildren (http://localhost:8069/web/assets/c42d6d9/web.assets_web.min.js:4250:171)

    at visit (http://localhost:8069/web/assets/c42d6d9/web.assets_web.min.js:4251:129)

    at visitChildren (http://localhost:8069/web/assets/c42d6d9/web.assets_web.min.js:4250:171)

Avatar
Kassér
Forfatter

i did everything correct in simple custom module in odoo 17 i just added a field in the res company model you can check my custom model here https://mega.nz/file/4pE0lA7D#idLXMCd-opGFMObO3ru-uUFiWh263pHKhGHLdsZx86A

Forfatter

problem solved it was a odoo.conf wrong addons path problem

Bedste svar

Are you mapping this file in the __init__.py file like this?

You need import file or folder to __init__ file.

Avatar
Kassér
Forfatter Bedste svar

well the problem here is that the field is added in the model check 

i created  a simple module in odoo 17 i want to add custom field to company view  

<odoo>
<record id="view_res_company_form_unique_view" model="ir.ui.view">
<field name="name">res.company.form.inherit.unique.view</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='company_registry']" position="after">
<field name="custom_field"/>
</xpath>
</field>
</record>
</odoo>



Manifest 

# -*- coding: utf-8 -*-
{
'name': "company_details",

'summary': "Short (1 phrase/line) summary of the module's purpose",

'description': """
Long description of module's purpose
""",

'author': "My Company",
'website': "https://www.yourcompany.com",

# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/15.0/odoo/addons/base/data/ir_module_category_data.xml
# for the full list
'category': 'Uncategorized',
'version': '0.1',

# any module necessary for this one to work correctly
'depends': ['base'],

# always loaded
'data': [
# 'security/ir.model.access.csv',
'views/res_company_views.xml',
],
}

class ResCompany(models.Model):
_inherit = 'res.company'

custom_field = fields.Char(string="Custom Field")
Avatar
Kassér
Bedste svar

You might have added a field custom_field in xml view file, but it is not defined in the corresponding model (res.company).

Solution: Define the field in the res.company model.

from odoo import fields, models 

class ResCompany(models.Model):

 _inherit = 'res.company' 

custom_field = fields.Char(string="Custom Field")

Avatar
Kassér