如何修复valueerror:ODOO中的系统中找不到的外部ID? thaving代码错误 例外:模块加载Hospital_Management失败:File HospitA_Management \ Security/ir.model.access.csv无法处理: 没有针对外部ID找到的匹配记录'

问题描述 投票:0回答:0
缺少所需值

上述服务器错误导致以下客户端错误: RPC_ERROR:ODOO服务器错误 rpc_error 在MakeErrorfromresponse(http:// localhost:8069/web/assets/12166fe/web.assets_web.min.js:3140:163) 请访问XMLHTTPREQUEST.

(http:// localhost:8069/web/Assets/12166fe/web.assets_web.min.js:3145:13)

代码

模型/医院_patient.py

从ODOO导入模型,字段

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

	

您已经在模块的根中插入_init文件吗? module | --- models | | | --- __init__.py ---- __init__.py


python debugging odoo
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.