admin管理员组

文章数量:1123595

Model in python:

from odoo import *


class Sync(models.Model):
  _name = "delium.sync"
  _description = "Sync module to sync data to Delium"

  odoo_host = fields.Char(string="Odoo Host", required=True)
  store_ids = fields.Many2many('stock.warehouse', 'odoo_sync_stores_rel', 'config_id', 'warehouse_id', string="Stores to Sync", required=True)

view.xml

<?xml version="1.0" encoding="utf-8"?>
<odoo>

  <record id="view_delium_sync_form" model="ir.ui.view">
    <field name="name">delium.sync.form</field>
    <field name="model">delium.sync</field>
    <field name="arch" type="xml">
      <form string="Sync Config">
        <p><b><i>
          The below configurations are used during the sync of data. Once registered, your data will be synced on a regular basis.
        </i></b></p>
        <sheet name="Database connection configuration.">
          <div class="o_stat_text">
            <h1>Sync Configs</h1>
          </div>
          <group>
            <div class="o_stat_text">Your Odoo URL.</div>
            <field name="odoo_host" />
            <div class="o_stat_text">Stores to sync data.</div>
            <field name="store_ids" widget="many2many_dropdown"/>
          </group>
        </sheet>
      </form>
    </field>
  </record>

  <record id="action_sync_settings_input" model="ir.actions.act_window">
    <field name="name">Sync Config</field>
    <field name="res_model">delium.sync</field>
    <field name="view_mode">list,form</field>
  </record>
</odoo>

I am getting the error -

UncaughtPromiseError > OwlError

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

Occured on localhost:8069 on 2025-01-10 08:47:28 GMT

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/debug/web.assets_web.js:9580:35)
        at App.handleError (http://localhost:8069/web/assets/debug/web.assets_web.js:13836:20)
        at ComponentNode.initiateRender (http://localhost:8069/web/assets/debug/web.assets_web.js:10382:26)

Caused by: Error: "_unknown"."id" field is undefined.
    at Field.parseFieldNode (http://localhost:8069/web/assets/debug/web.assets_web.js:73228:19)
    at ListArchParser.parseFieldNode (http://localhost:8069/web/assets/debug/web.assets_web.js:89939:22)
    at http://localhost:8069/web/assets/debug/web.assets_web.js:90003:40
    at visit (http://localhost:8069/web/assets/debug/web.assets_web.js:45469:41)
    at visitChildren (http://localhost:8069/web/assets/debug/web.assets_web.js:45465:21)
    at visit (http://localhost:8069/web/assets/debug/web.assets_web.js:45471:17)
    at visitXML (http://localhost:8069/web/assets/debug/web.assets_web.js:45476:5)
    at ListArchParser.parse (http://localhost:8069/web/assets/debug/web.assets_web.js:89969:9)
    at loadSubViews (http://localhost:8069/web/assets/debug/web.assets_web.js:84956:43)
    at async Object.beforeFirstLoad (http://localhost:8069/web/assets/debug/web.assets_web.js:85042:13)

If I remove the store_ids field from my view xml, it renders fine. So I know its related to the many2many field. But cant figure out what I am doing wrong.

The tables odoo_sync_stores_rel, stock.warehouse & delium.sync exist.

This was working fine, but has recently failed despite no code changes.

Note: This is for odoo18.

本文标签: Odoo Many2Many field fails to renderStack Overflow