admin管理员组文章数量:1278820
Having code error
Exception: Module loading hospital_management failed: file hospital_management\security/ir.model.access.csv could not be processed: No matching record found for external id 'model_hospital_patient' in field 'Model' Missing required value for the field 'Model' (model_id)
The above server error caused the following client error: RPC_ERROR: Odoo Server Error RPC_ERROR at makeErrorFromResponse (http://localhost:8069/web/assets/12166fe/web.assets_web.min.js:3140:163) at XMLHttpRequest.<anonymous> (http://localhost:8069/web/assets/12166fe/web.assets_web.min.js:3145:13)
code
models/hospital_patient.py
`from odoo import models, fields
class HospitalPatient(models.Model):
_name = 'hospital.patient'
_description = 'Hospital Patient'
name = fields.Char(string='Patient Name', required=True)
age = fields.Integer(string='Age')
gender = fields.Selection([('male', 'Male'), ('female', 'Female')], string='Gender')
disease = fields.Char(string='Disease')
hospital_patient_views.xml
<odoo><data>
<record id="view_hospital_patient_tree" model="ir.ui.view">
<field name="name">hospital.patient.tree</field>
<field name="model">hospital.patient</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="age"/>
<field name="gender"/>
<field name="disease"/>
</tree>
</field>
</record>
<record id="view_hospital_patient_form" model="ir.ui.view">
<field name="name">hospital.patient.form</field>
<field name="model">hospital.patient</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<field name="name"/>
<field name="age"/>
<field name="gender"/>
<field name="disease"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="model_hospital_patient" model="ir.model">
<field name="name">hospital.patient</field>
<field name="model">hospital.patient</field>
<field name="state">manual</field>
</record>
<menuitem id="menu_hospital_management_root" name="Hospital Management"/>
<menuitem id="menu_hospital_patient" name="Patients" parent="menu_hospital_management_root" action="action_hospital_patient"/>
</data></odoo>
security/ir.model.access.csv
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_hospital_patient,hospital_patient,model_hospital_patient,,1,1,1,1
本文标签: pythonHow to Fix ValueError External ID not found in the system in OdooStack Overflow
版权声明:本文标题:python - How to Fix ValueError: External ID not found in the system in Odoo? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741210026a2358928.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论