系统中未找到外部 ID:training.training_odoo_menu

如何解决系统中未找到外部 ID:training.training_odoo_menu

所以我正在接受培训,我得到了创建一些自定义模块的任务,当代码仍然像这样时它运行良好

models.py

class Kursus(models.Model):
    _name = 'training.kursus'
     
    name = fields.Char(string="Judul",required=True)
    description = fields.Text()

class Sesi(models.Model):
    _name = 'training.sesi'
     
    name = fields.Char(required=True)
    start_date = fields.Date()
    duration = fields.Float(digits=(6,2),help="Durasi Hari")
    seats = fields.Integer(string="Jumlah Kursi")
    instructor_id = fields.Many2one('res.partner',string="Instruktur")

view.xml 是这样的:

<odoo>
    <data>
    <!-- ### Membuat Tampilan Tree/List Sesi ### -->
     
    <record model="ir.ui.view" id="sesi_tree_view">
        <field name="name">training.sesi.tree</field>
        <field name="model">training.sesi</field>
        <field name="arch" type="xml">
            <tree string="Sesi List">
                <field name="name"/>
                <field name="start_date"/>
                <field name="duration"/>
                <field name="seats"/>
                <field name="instructor_id"/>      
            </tree>
        </field>
    </record>
     
     
    <!-- ### Membuat Tampilan Form Sesi ### -->
         
    <record model="ir.ui.view" id="sesi_form_view">
        <field name="name">training.sesi.form</field>
        <field name="model">training.sesi</field>
        <field name="arch" type="xml">
            <form string="Sesi Form">
                <sheet>
                    <group>
                        <field name="name"/>
                        <field name="start_date"/>
                        <field name="duration"/>
                        <field name="seats"/>
                        <field name="instructor_id"/>
                    </group>
                </sheet>
            </form>
        </field>
    </record>
     
     
    <!-- ### Membuat Action/Event Object Sesi ### -->
     
    <record model="ir.actions.act_window" id="sesi_list_action">
        <field name="name">Sesi</field>
        <field name="res_model">training.sesi</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
    </record>
     
     
    <!-- ### Membuat Sub Menu Sesi ### -->
     
    <menuitem id="sesi_menu" name="Sesi" parent="training_odoo_menu" action="sesi_list_action"/>
    
    </data>
    </odoo>

但是当我将models.py更新为这样时,就像我下面的代码一样,它会出错,错误出现在这个问题的最后

    class Kursus(models.Model):
        _name = 'training.kursus'
     
        name = fields.Char(string="Judul",required=True)
        description = fields.Text()
        session_ids = fields.One2many('training.sesi','course_id',string="Sesi")
    
    class Sesi(models.Model):
        _name = 'training.sesi'
         
        name = fields.Char(required=True)
        start_date = fields.Date()
        duration = fields.Float(digits=(6,help="Durasi Hari")
        seats = fields.Integer(string="Jumlah Kursi")
        instructor_id = fields.Many2one('res.partner',string="Instruktur")
        course_id = fields.Many2one('training.kursus',ondelete='cascade',string="Kursus",required=True)

and the view.xml like this

<record model="ir.ui.view" id="kursus_form_view">
    <field name="name">training.kursus.form</field>
    <field name="model">training.kursus</field>
    <field name="arch" type="xml">
        <form string="Kursus Form">
            <sheet>
                <group>
                    <field name="name"/>
                </group>
                <notebook>
                    <page string="Keterangan">
                        <field name="description"/>
                    </page>
                    <page string="Sesi">
                        <field name="session_ids">
                            <tree string="Daftar Sesi">
                                <field name="name"/>
                                <field name="instructor_id"/>
                            </tree>
                            <form>
                                <group string="Informasi">
                                    <field name="name"/>
                                    <field name="instructor_id"/>
                                </group>
                                <group string="Jadwal">
                                    <field name="start_date"/>
                                    <field name="duration"/>
                                    <field name="seats"/>
                                </group>
                            </form>
                        </field>
                    </page>
                </notebook>
            </sheet>
        </form>
    </field>
</record>
 
 
 
 
<!-- ### Membuat Tampilan Tree/List Sesi ### -->
 
<record model="ir.ui.view" id="sesi_tree_view">
    <field name="name">training.sesi.tree</field>
    <field name="model">training.sesi</field>
    <field name="arch" type="xml">
        <tree string="Sesi List">
            <field name="name"/>
            <field name="course_id"/>
            <field name="start_date"/>
            <field name="duration"/>
            <field name="seats"/>
            <field name="instructor_id"/>      
        </tree>
    </field>
</record>
 
 
<!-- ### Membuat Tampilan Form Sesi ### -->
     
<record model="ir.ui.view" id="sesi_form_view">
    <field name="name">training.sesi.form</field>
    <field name="model">training.sesi</field>
    <field name="arch" type="xml">
        <form string="Sesi Form">
            <sheet>
                <group>
                    <group string="Informasi">
                        <field name="course_id"/>
                        <field name="name"/>
                        <field name="instructor_id"/>
                    </group>
                    <group string="Jadwal">
                        <field name="start_date"/>
                        <field name="duration"/>
                        <field name="seats"/>
                    </group>
                </group>
            </sheet>
        </form>
    </field>
</record>

 
<!-- ### Membuat Action/Event Object Sesi ### -->
 
<record model="ir.actions.act_window" id="sesi_list_action">
    <field name="name">Sesi</field>
    <field name="res_model">training.sesi</field>
    <field name="view_type">form</field>
    <field name="view_mode">tree,form</field>
</record>
 
 
<!-- ### Membuat Sub Menu Sesi ### -->
 
<menuitem id="sesi_menu" name="Sesi" parent="training_odoo_menu" action="sesi_list_action"/>

  </data>
</odoo>

我在 odoo 中升级模块时遇到此错误 错误:

Odoo Server Error

Traceback (most recent call last):
  File "/home/fauz2n/odoo/odoo-12/odoo/tools/cache.py",line 88,in lookup
    r = d[key]
  File "/home/fauz2n/odoo/odoo-12/odoo/tools/func.py",line 69,in wrapper
    return func(self,*args,**kwargs)
  File "/home/fauz2n/odoo/odoo-12/odoo/tools/lru.py",line 44,in __getitem__
    a = self.d[obj].me
KeyError: ('ir.model.data',<function IrModelData.xmlid_lookup at 0x7fec8f847d90>,'training.training_odoo_menu')

During handling of the above exception,another exception occurred:

Traceback (most recent call last):
  File "/home/fauz2n/odoo/odoo-12/odoo/tools/convert.py",line 758,in parse
    self._tags[rec.tag](rec,de,mode=mode)
  File "/home/fauz2n/odoo/odoo-12/odoo/tools/convert.py",line 455,in _tag_menuitem
    menu_parent_id = self.id_get(rec.get('parent',''))
  File "/home/fauz2n/odoo/odoo-12/odoo/tools/convert.py",line 741,in id_get
    res = self.model_id_get(id_str,raise_if_not_found)
  File "/home/fauz2n/odoo/odoo-12/odoo/tools/convert.py",line 747,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 "/home/fauz2n/odoo/addons/ORIGINAL12/base/models/ir_model.py",line 1404,in xmlid_to_res_model_res_id
    return self.xmlid_lookup(xmlid)[1:3]
  File "<decorator-gen-25>",line 2,in xmlid_lookup
  File "/home/fauz2n/odoo/odoo-12/odoo/tools/cache.py",line 93,in lookup
    value = d[key] = self.method(*args,**kwargs)
  File "/home/fauz2n/odoo/addons/ORIGINAL12/base/models/ir_model.py",line 1393,in xmlid_lookup
    raise ValueError('External ID not found in the system: %s' % xmlid)
ValueError: External ID not found in the system: training.training_odoo_menu

During handling of the above exception,another exception occurred:

Traceback (most recent call last):
  File "/home/fauz2n/odoo/odoo-12/odoo/http.py",line 656,in _handle_exception
    return super(JsonRequest,self)._handle_exception(exception)
  File "/home/fauz2n/odoo/odoo-12/odoo/http.py",line 314,in _handle_exception
    raise pycompat.reraise(type(exception),exception,sys.exc_info()[2])
  File "/home/fauz2n/odoo/odoo-12/odoo/tools/pycompat.py",line 87,in reraise
    raise value
  File "/home/fauz2n/odoo/odoo-12/odoo/http.py",line 698,in dispatch
    result = self._call_function(**self.params)
  File "/home/fauz2n/odoo/odoo-12/odoo/http.py",line 346,in _call_function
    return checked_call(self.db,**kwargs)
  File "/home/fauz2n/odoo/odoo-12/odoo/service/model.py",line 97,in wrapper
    return f(dbname,**kwargs)
  File "/home/fauz2n/odoo/odoo-12/odoo/http.py",line 339,in checked_call
    result = self.endpoint(*a,**kw)
  File "/home/fauz2n/odoo/odoo-12/odoo/http.py",line 941,in __call__
    return self.method(*args,line 519,in response_wrap
    response = f(*args,**kw)
  File "/home/fauz2n/odoo/addons/ORIGINAL12/web/controllers/main.py",line 966,in call_button
    action = self._call_kw(model,method,args,{})
  File "/home/fauz2n/odoo/addons/ORIGINAL12/web/controllers/main.py",line 954,in _call_kw
    return call_kw(request.env[model],kwargs)
  File "/home/fauz2n/odoo/odoo-12/odoo/api.py",line 759,in call_kw
    return _call_kw_multi(method,model,line 746,in _call_kw_multi
    result = method(recs,**kwargs)
  File "<decorator-gen-67>",in button_immediate_upgrade
  File "/home/fauz2n/odoo/addons/ORIGINAL12/base/models/ir_module.py",line 74,in check_and_log
    return method(self,**kwargs)
  File "/home/fauz2n/odoo/addons/ORIGINAL12/base/models/ir_module.py",line 622,in button_immediate_upgrade
    return self._button_immediate_function(type(self).button_upgrade)
  File "/home/fauz2n/odoo/addons/ORIGINAL12/base/models/ir_module.py",line 561,in _button_immediate_function
    modules.registry.Registry.new(self._cr.dbname,update_module=True)
  File "/home/fauz2n/odoo/odoo-12/odoo/modules/registry.py",line 86,in new
    odoo.modules.load_modules(registry._db,force_demo,status,update_module)
  File "/home/fauz2n/odoo/odoo-12/odoo/modules/loading.py",line 417,in load_modules
    force,report,loaded_modules,update_module,models_to_check)
  File "/home/fauz2n/odoo/odoo-12/odoo/modules/loading.py",line 313,in load_marked_modules
    perform_checks=perform_checks,models_to_check=models_to_check
  File "/home/fauz2n/odoo/odoo-12/odoo/modules/loading.py",line 222,in load_module_graph
    load_data(cr,idref,mode,kind='data',package=package,report=report)
  File "/home/fauz2n/odoo/odoo-12/odoo/modules/loading.py",line 68,in load_data
    tools.convert_file(cr,package.name,filename,noupdate,kind,report)
  File "/home/fauz2n/odoo/odoo-12/odoo/tools/convert.py",line 802,in convert_file
    convert_xml_import(cr,module,fp,line 865,in convert_xml_import
    obj.parse(doc.getroot(),line 755,in parse
    self.parse(rec,mode)
  File "/home/fauz2n/odoo/odoo-12/odoo/tools/convert.py",line 764,in parse
    exc_info[2]
  File "/home/fauz2n/odoo/odoo-12/odoo/tools/pycompat.py",in reraise
    raise value.with_traceback(tb)
  File "/home/fauz2n/odoo/odoo-12/odoo/tools/convert.py",in xmlid_lookup
    raise ValueError('External ID not found in the system: %s' % xmlid)
odoo.tools.convert.ParseError: "External ID not found in the system: training.training_odoo_menu" while parsing /home/fauz2n/odoo/addons/NDT/training/views/views.xml:159,near
<menuitem id="sesi_menu" name="Sesi" parent="training_odoo_menu" action="sesi_list_action"/>

有谁能帮帮我吗?如果有人遇到同样的问题,请分享一下解决方案

解决方法

在您的代码中,您有菜单项:

<menuitem id="sesi_menu" name="Sesi" parent="training_odoo_menu" action="sesi_list_action"/>

这具有属性 parent="training_odoo_menu",但是,我在视图中看不到父菜单项?

如果您希望此菜单项成为菜单根,您需要删除 parent 属性。如果它存在于另一个模块中,请确保首先在清单中处理该文件。

如果您需要澄清任何事情,请告诉我,

谢谢,

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-
参考1 参考2 解决方案 # 点击安装源 协议选择 http:// 路径填写 mirrors.aliyun.com/centos/8.3.2011/BaseOS/x86_64/os URL类型 软件库URL 其他路径 # 版本 7 mirrors.aliyun.com/centos/7/os/x86
报错1 [root@slave1 data_mocker]# kafka-console-consumer.sh --bootstrap-server slave1:9092 --topic topic_db [2023-12-19 18:31:12,770] WARN [Consumer clie
错误1 # 重写数据 hive (edu)&gt; insert overwrite table dwd_trade_cart_add_inc &gt; select data.id, &gt; data.user_id, &gt; data.course_id, &gt; date_format(
错误1 hive (edu)&gt; insert into huanhuan values(1,&#39;haoge&#39;); Query ID = root_20240110071417_fe1517ad-3607-41f4-bdcf-d00b98ac443e Total jobs = 1
报错1:执行到如下就不执行了,没有显示Successfully registered new MBean. [root@slave1 bin]# /usr/local/software/flume-1.9.0/bin/flume-ng agent -n a1 -c /usr/local/softwa
虚拟及没有启动任何服务器查看jps会显示jps,如果没有显示任何东西 [root@slave2 ~]# jps 9647 Jps 解决方案 # 进入/tmp查看 [root@slave1 dfs]# cd /tmp [root@slave1 tmp]# ll 总用量 48 drwxr-xr-x. 2
报错1 hive&gt; show databases; OK Failed with exception java.io.IOException:java.lang.RuntimeException: Error in configuring object Time taken: 0.474 se
报错1 [root@localhost ~]# vim -bash: vim: 未找到命令 安装vim yum -y install vim* # 查看是否安装成功 [root@hadoop01 hadoop]# rpm -qa |grep vim vim-X11-7.4.629-8.el7_9.x
修改hadoop配置 vi /usr/local/software/hadoop-2.9.2/etc/hadoop/yarn-site.xml # 添加如下 &lt;configuration&gt; &lt;property&gt; &lt;name&gt;yarn.nodemanager.res