问题
Please could someone tell me what's wrong with my code. I have developed a module on openerp7, and now i'am trying to use a css class already existing in the base.css file but it gave me the error :
Invalid XML for View Architecture!
I've then updated my module and the Web module that contains the base.css file. I also checked that the web module is installed.I have as well restarted the server.
here's how I've added the class:
<field name="production" class="oe_edit_only"/>
here's the full form view:
<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>
and the Traceback:
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é')]"/>
<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>
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!
Traceback (most recent call last):
回答1:
try to use 7.0 style pls (no need for field type and use attribute version on form-tag:
<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>
hope that will help you
回答2:
try putting that field inside a div ans specify the class for that div
来源:https://stackoverflow.com/questions/22299513/openerp-css-class-not-recognized