gpt4 book ai didi

python - Odoo 8 找不到模块或字段

转载 作者:行者123 更新时间:2023-11-29 13:26:19 27 4
gpt4 key购买 nike

我是 odoo 模块的新手,所以我不太明白。我收到类似这样的错误:

reference.book.bb module not found

我不知道我的模块如何工作:reference.book.aa :D 但它工作。

或者像这样的错误:

Field medical_id not found

谁能帮帮我?我一整天都在努力理解它,但是......一些代码贴在问题下面。

这是我想要的: enter image description here

openerp.py

{
'name': 'AAA',
'version': '1.0',
'author': 'LALA',
'description': '''
OOO.
====================================
''',
'category': 'Website',
'depends': [
'base',
'hr',
'disable_openerp_online',
'download_action',
],
'data': [
'security/security.xml',
'security/ir.model.access.csv',
'static/src/xml/view.xml',
'views/website.xml',
'views/reference_book.xml',
'report/report.xml',
],
'installable': True
}

初始化.py

import controllers
import models

模型/初始化.py

import website
import ambulance_call_form
import res_partner
import reference_book

模型/reference_book.py

from openerp import models, fields, api

class referenceBookView(models.Model):
_name = 'reference.book.aa'

mdeical_id = fields.Integer(string="ID")
mdeical_name = fields.Char(string="Name")

views/reference_book.xml

<openerp>
<data>
<!-- Medical List START -->
<record model="ir.ui.view" id="view_reference_book_form">
<field name="name">Reference book</field>
<field name="model">reference.book.aa</field>
<field name="view_type">tree</field>
<field name="view_mode">tree,form</field>
<field name="arch" type="xml">
<tree string="Reference book tree">
<field name="mdeical_id" />
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_medication_list">
<field name="name">Medication list</field>
<field name="res_model">reference.book.aa</field>
<field name="view_type">tree</field>
<field name="view_mode">form,tree</field>
<field name='view_id' ref='view_reference_book_form'/>
<field name="arch" type="xml">
<tree string="Medication list tree">

</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_medication_list">
<field name="name">Medication list</field>
<field name="res_model">reference.book.aa</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name='view_id' ref='view_reference_book_form'/>
<field name="arch" type="xml">
<form string="Medication list form">

</form>
</field>
</record>
<!-- Medical List END -->

<!-- Heart Rythm List Start -->
<record model="ir.ui.view" id="view_heart_rythm_tree">
<field name="name">Heart rhythm disturbances</field>
<field name="model">reference.book.aa</field>
<field name="view_type">tree</field>
<field name="view_mode">tree,form</field>
<field name="arch" type="xml">
<tree string="Heart rhythm disturbances tree">

</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_heart_rythm_disturbations_list">
<field name="name">Heart rhythm disturbances list</field>
<field name="res_model">reference.book.aa</field>
<field name="view_type">tree</field>
<field name="view_mode">form,tree</field>
<field name='view_id' ref='view_heart_rythm_tree'/>
<field name="arch" type="xml">
<tree string="Medication list tree">

</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_heart_rythm_disturbations_list">
<field name="name">Heart rhythm disturbances list</field>
<field name="res_model">reference.book.aa</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name='view_id' ref='view_heart_rythm_tree'/>
<field name="arch" type="xml">
<form string="Heart rhythm disturbances form">

</form>
</field>
</record>
<!-- Heart Rythm List End -->

<!-- ST Segment List Start -->
<record model="ir.ui.view" id="view_st_segment_tree">
<field name="name">ST segment of changes in evaluation</field>
<field name="model">reference.book.aa</field>
<field name="view_type">tree</field>
<field name="view_mode">tree,form</field>
<field name="arch" type="xml">
<tree string="ST segment of changes in evaluation tree">

</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_st_segment_list">
<field name="name">ST segment of changes in evaluation list</field>
<field name="res_model">reference.book.aa</field>
<field name="view_type">tree</field>
<field name="view_mode">form,tree</field>
<field name='view_id' ref='view_st_segment_tree'/>
<field name="arch" type="xml">
<tree string="ST segment of changes in evaluation tree">

</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_st_segment_list">
<field name="name">ST segment of changes in evaluation list</field>
<field name="res_model">reference.book.aa</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name='view_id' ref='view_st_segment_tree'/>
<field name="arch" type="xml">
<form string="ST segment of changes in evaluation form">

</form>
</field>
</record>
<!-- ST Segment List End -->

<!-- Status List Start -->
<record model="ir.ui.view" id="view_status_tree">
<field name="name">Status</field>
<field name="model">reference.book.aa</field>
<field name="view_type">tree</field>
<field name="view_mode">tree,form</field>
<field name="arch" type="xml">
<tree string="Status tree">

</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_status_list">
<field name="name">Status list</field>
<field name="res_model">reference.book.aa</field>
<field name="view_type">tree</field>
<field name="view_mode">form,tree</field>
<field name='view_id' ref='view_status_tree'/>
<field name="arch" type="xml">
<tree string="Status tree">

</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_status_list">
<field name="name">Status list</field>
<field name="res_model">reference.book.aa</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name='view_id' ref='view_status_tree'/>
<field name="arch" type="xml">
<form string="Status form">

</form>
</field>
</record>
<!-- Status List End -->

<!-- Pharmaceutical Administration List Start -->
<record model="ir.ui.view" id="view_pharmaceutical_administration_tree">
<field name="name">Pharmaceutical administration</field>
<field name="model">reference.book.aa</field>
<field name="view_type">tree</field>
<field name="view_mode">tree,form</field>
<field name="arch" type="xml">
<tree string="Pharmaceutical administration tree">

</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_pharmaceutical_administration_list">
<field name="name">Pharmaceutical administration list</field>
<field name="res_model">reference.book.aa</field>
<field name="view_type">tree</field>
<field name="view_mode">form,tree</field>
<field name='view_id' ref='view_pharmaceutical_administration_tree'/>
<field name="arch" type="xml">
<tree string="Pharmaceutical administration tree">

</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_pharmaceutical_administration_list">
<field name="name">Pharmaceutical administration list</field>
<field name="res_model">reference.book.aa</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name='view_id' ref='view_pharmaceutical_administration_tree'/>
<field name="arch" type="xml">
<form string="Pharmaceutical administration form">

</form>
</field>
</record>
<!-- Pharmaceutical Administration List End -->

<!-- Product Use Intensity List Start -->
<record model="ir.ui.view" id="view_product_intensity_tree">
<field name="name">Product use intensity</field>
<field name="model">reference.book.aa</field>
<field name="view_type">tree</field>
<field name="view_mode">tree,form</field>
<field name="arch" type="xml">
<tree string="Product use intensity tree">

</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_product_use_intensity_list">
<field name="name">Product use intensity list</field>
<field name="res_model">reference.book.aa</field>
<field name="view_type">tree</field>
<field name="view_mode">form,tree</field>
<field name='view_id' ref='view_product_intensity_tree'/>
<field name="arch" type="xml">
<tree string="Product use intensity tree">

</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_product_use_intensity_list">
<field name="name">Product use intensity list</field>
<field name="res_model">reference.book.aa</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name='view_id' ref='view_product_intensity_tree'/>
<field name="arch" type="xml">
<form string="Product use intensity form">

</form>
</field>
</record>
<!-- Product Use Intensity List End -->

<!-- Procedures List Start -->
<record model="ir.ui.view" id="view_procedures_tree">
<field name="name">Procedures</field>
<field name="model">reference.book.aa</field>
<field name="view_type">tree</field>
<field name="view_mode">tree,form</field>
<field name="arch" type="xml">
<tree string="Procedures tree">

</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_procedures_list">
<field name="name">Procedures list</field>
<field name="res_model">reference.book.aa</field>
<field name="view_type">tree</field>
<field name="view_mode">form,tree</field>
<field name='view_id' ref='view_procedures_tree'/>
<field name="arch" type="xml">
<tree string="Procedures tree">

</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_procedures_list">
<field name="name">Procedures list</field>
<field name="res_model">reference.book.aa</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name='view_id' ref='view_procedures_tree'/>
<field name="arch" type="xml">
<form string="Procedures form">

</form>
</field>
</record>
<!-- Procedures List End -->

<!-- Pain Scale List Start -->
<record model="ir.ui.view" id="view_pain_scale_tree">
<field name="name">Pain scale</field>
<field name="model">reference.book.aa</field>
<field name="view_type">tree</field>
<field name="view_mode">tree,form</field>
<field name="arch" type="xml">
<tree string="Pain scale tree">

</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_pain_scale_list">
<field name="name">Pain scale list</field>
<field name="res_model">reference.book.aa</field>
<field name="view_type">tree</field>
<field name="view_mode">form,tree</field>
<field name='view_id' ref='view_pain_scale_tree'/>
<field name="arch" type="xml">
<tree string="Pain scale tree">

</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_pain_scale_list">
<field name="name">Pain scale list</field>
<field name="res_model">reference.book.aa</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name='view_id' ref='view_pain_scale_tree'/>
<field name="arch" type="xml">
<form string="Pain scale tree">

</form>
</field>
</record>
<!-- Pain Scale List End -->

<!-- Menu Start -->
<menuitem id="menu_reference_book" name="Reference book" sequence="500" />
<menuitem id="menu_medical_list" name="Reference book Lists" parent="menu_reference_book" sequence="500" />
<menuitem id="menu_medication_list" action="action_medication_list" parent="menu_medical_list" sequence="500"/>
<menuitem id="menu_heart_rythm_disturbations_list" action="action_heart_rythm_disturbations_list" parent="menu_medical_list" sequence="501"/>
<menuitem id="menu_segment_of_changes_in_evaluation" action="action_st_segment_list" parent="menu_medical_list" sequence="502"/>
<menuitem id="menu_status_list" action="action_status_list" parent="menu_medical_list" sequence="503"/>
<menuitem id="menu_pharmaceutical_administration_list" action="action_pharmaceutical_administration_list" parent="menu_medical_list" sequence="504"/>
<menuitem id="menu_product_use_intensity_list" action="action_product_use_intensity_list" parent="menu_medical_list" sequence="505"/>
<menuitem id="menu_procedures_list" action="action_procedures_list" parent="menu_medical_list" sequence="506"/>
<menuitem id="menu_pain_scale_list" action="action_pain_scale_list" parent="menu_medical_list" sequence="507"/>
<!-- Menu End -->
</data>

错误:

ParseError: "ValidateError
Field(s) `arch` failed against a constraint: Invalid view definition

Error details:
Field `mdeical_id` does not exist

Error context:
View `Reference book`
[view_id: 510, xml_id: n/a, model: reference.book.aa, parent_id: n/a]" while parsing file:///C:/Program%20Files%20(x86)/Odoo%208.0-20151013/server/openerp/addons/gmps/views/reference_book.xml:12, near
<record model="ir.ui.view" id="view_reference_book_form">
<field name="name">Reference book</field>
<field name="model">reference.book.aa</field>
<field name="view_type">tree</field>
<field name="view_mode">tree,form</field>
<field name="arch" type="xml">
<tree string="Reference book tree">
<field name="mdeical_id"/>
</tree>
</field>
</record>

或者与模块相同。

最佳答案

根据新的 api,您应该按如下方式更新代码,

from openerp import models, fields, api

class ReferenceBookAa(models.Model):
_name = 'reference.book.aa'

#### Define fields here
medical_id = fields.Integer('ID')

供您引用

Odoo new API guideline

Odoo documentation

关于python - Odoo 8 找不到模块或字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33224844/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com