1

请有人告诉我我的代码有什么问题。我在 openerp7 上开发了一个模块,现在我正在尝试使用 base.css 文件中已经存在的css类,它给了我错误:

视图架构的 XML 无效!

然后我更新了我的模块和包含base.css文件的Web 模块。我还检查了 web 模块是否已安装。我也重新启动了服务器。

这是我添加课程的方式:

<field name="production" class="oe_edit_only"/>

这是完整的表单视图:

<record model="ir.ui.view" id="view_ordres_fabrication_form">
    <field name="name">ordres_fabrication.form</field>
    <field name="model">ordres_fabrication</field>
    <field name="type">form</field>
    <field name="arch" type="xml">
        <form string="ordres de fabrication">
            <field name="numero"/>
            <field name="commande_id" on_change="onchange_numero_bc(commande_id)" domain="[('etat','!=','Terminé')]"/> 
            <field name="quantite"/> 
            <field name="piece_id"/> 
            <field name="numero_lot"/> 
            <field name="delai"/> 
            <field name="etat"/>
            <separator string="Quantités produites par opération"/>
            <field name="production" class="oe_edit_only">
                <tree>
                    <field name="operation_nom" context="{'group_by': ['operation_nom','of_num'] }"/>
                    <field name="quantite_op"/>
                </tree>
            </field>
        </form>
    </field>
</record>

和回溯:

2014-03-10 13:49:30,016 7080 ERROR BD openerp.addons.base.ir.ir_ui_view: <string>:10:0:ERROR:RELAXNGV:RELAXNG_ERR_NOELEM: Expecting an element diagram, got nothing
2014-03-10 13:49:30,016 7080 ERROR BD openerp.addons.base.ir.ir_ui_view: <string>:10:0:ERROR:RELAXNGV:RELAXNG_ERR_INVALIDATTR: Invalid attribute class for element field
2014-03-10 13:49:30,016 7080 ERROR BD openerp.addons.base.ir.ir_ui_view: <string>:2:0:ERROR:RELAXNGV:RELAXNG_ERR_EXTRACONTENT: Element form has extra content: field
2014-03-10 13:49:30,029 7080 ERROR BD openerp.tools.convert: Parse error in file:///C:/Program%20Files%20(x86)/OpenERP%207.0-20140120-002508/Server/server/openerp/addons/gestion_de_production/ordres_fabrication_view.xml:4: 
<record model="ir.ui.view" id="view_ordres_fabrication_form">
    <field name="name">ordres_fabrication.form</field>
    <field name="model">ordres_fabrication</field>
    <field name="type">form</field>
    <field name="arch" type="xml">
        <form string="ordres de fabrication">
            <field name="numero"/>
            <field name="commande_id" on_change="onchange_numero_bc(commande_id)" domain="[('etat','!=','Termin&#233;')]"/> 
            <field name="quantite"/> 
            <field name="piece_id"/> 
            <field name="numero_lot"/> 
            <field name="delai"/> 
            <field name="etat"/>
            <separator string="Quantit&#233;s produites par op&#233;ration"/>
            <field name="production" class="oe_edit_only">
                <tree>
                    <field name="operation_nom" context="{'group_by': ['operation_nom','of_num'] }"/>
                    <field name="quantite_op"/>
                </tree>
            </field>
        </form>
    </field>
</record>
Traceback (most recent call last):
File "C:\Program Files (x86)\OpenERP 7.0-20140120-002508\Server\server\.\openerp\tools\convert.py", line 847, in parse
File "C:\Program Files (x86)\OpenERP 7.0-20140120-002508\Server\server\.\openerp\tools\convert.py", line 814, in _tag_record
File "C:\Program Files (x86)\OpenERP 7.0-20140120-002508\Server\server\openerp\addons\base\ir\ir_model.py", line 940, in _update
File "C:\Program Files (x86)\OpenERP 7.0-20140120-002508\Server\server\openerp\addons\base\ir\ir_ui_view.py", line 214, in write
File "C:\Program Files (x86)\OpenERP 7.0-20140120-002508\Server\server\.\openerp\osv\orm.py", line 4224, in write
File "C:\Program Files (x86)\OpenERP 7.0-20140120-002508\Server\server\.\openerp\osv\orm.py", line 1561, in _validate
except_orm: ('ValidateError', u'Une erreur est apparue lors de la validation du/des champ(s) arch: Invalid XML for View Architecture!')
2014-03-10 13:49:30,030 7080 ERROR BD openerp.netsvc: ValidateError
Une erreur est apparue lors de la validation du/des champ(s) arch: Invalid XML for View Architecture!

回溯(最近一次通话最后):

4

2 回答 2

1

请尝试使用 7.0 样式(不需要字段类型并在表单标签上使用属性版本:

<record model="ir.ui.view" id="view_ordres_fabrication_form">
    <field name="name">ordres_fabrication.form</field>
    <field name="model">ordres_fabrication</field>
    <field name="arch" type="xml">
        <form string="ordres de fabrication" version="7.0">
            <field name="numero"/>
            <field name="commande_id" on_change="onchange_numero_bc(commande_id)" domain="[('etat','!=','Terminé')]"/> 
            <field name="quantite"/> 
            <field name="piece_id"/> 
            <field name="numero_lot"/> 
            <field name="delai"/> 
            <field name="etat"/>
            <separator string="Quantités produites par opération"/>
            <field name="production" class="oe_edit_only">
                <tree>
                    <field name="operation_nom" context="{'group_by': ['operation_nom','of_num'] }"/>
                    <field name="quantite_op"/>
                </tree>
            </field>
        </form>
    </field>
</record>

希望对你有帮助

于 2014-03-17T13:35:51.093 回答
0

尝试将该字段放在 div 中并指定该 div 的类

于 2014-03-11T12:45:28.187 回答