odoo ir.rule xml id not found error

筅森魡賤 提交于 2019-12-11 07:12:55

问题


openerp.py

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

# always loaded
'data': [
    'security/ir.rule.xml',
    'security/ir.model.access.csv',
    'views/views.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> 

after restart odoo and update the model the error said:

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?

thank you :)


回答1:


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

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'

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



来源:https://stackoverflow.com/questions/43061771/odoo-ir-rule-xml-id-not-found-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!