找不到odoo ir.rule xml ID错误 [英] odoo ir.rule xml id not found error

查看:56
本文介绍了找不到odoo ir.rule xml ID错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

openerp.py

openerp.py

    'depends': ['base','hr'],

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

security/ir.rule.xml

security/ir.rule.xml

  <data noupdate="0">
<record id="property_rule_jj_loan_creator" model="ir.rule" forcecreate="True">
    <field name="name">loan creator</field>
    <field name="model_id" ref="model_jj_loan"/>
    <field name="domain_force">[('employee_id.user_id','=',user.id), ('state', '=', 'Draft')]</field>
    <field name="perm_create" eval="True"/>
    <field name="perm_write" eval="True"/>
    <field name="perm_unlink" eval="True"/>
    <field name="groups" eval="[(4,ref('base.group_user'))]"/>
</record> 

重启odoo后更新模型 错误说:

after restart odoo and update the model the error said:

提高ValueError('在系统中找不到外部ID:%s'%(xmlid)) ParseError:在系统中找不到外部ID:model_jj_loan" 解析/home/addons/jj_loan/security/ir.rule.xml:4,在附近

raise ValueError('External ID not found in the system: %s' % (xmlid)) ParseError: "External ID not found in the system: model_jj_loan" while parsing /home/addons/jj_loan/security/ir.rule.xml:4, near

我已经看到许多示例代码与我的示例代码相同,所以有什么我想念的吗?

I have seen many examples codes are the same as mine, so is there anything I have missed?

谢谢:)

推荐答案

错误与模型名称有关:model_jj_loan 在您的数据库上未创建模型jj.loan:

error is about the name of the model : model_jj_loan the Model jj.loan is not created on you database:

检查模型名称是否必须是这样,如果不需要,请更改xml文件上的名称:

check the name of your model must be like this if not you need to change the name on the xml file :

_name = 'jj.loan'

如果存在与您需要检查数据库是否在表上创建的名称相同的名称,请使用pgAdmin,我认为您将找不到它.如果是这样 : 确保将您的模块.py导入到__init__.py中,因为如果__init__.py中不存在odoo则不会在数据库上安装模型,如果您没有解决问题,则将模型代码放入问题中

if is there with the same name than you need to check if the table is created on your database use pgAdmin and i think you will not found it. if so : make sure that you import the you module .py in the __init__.py because odoo will not install a model on the database if it does not exists in __init__.py put the model code in the question if you didn't solve the prob

这篇关于找不到odoo ir.rule xml ID错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆