0
votes

In my custom module, i tried to do some design in it's xml view (sheets, groups, notebook...)

And i'm facing this problem "Invalid XML Architecture - OpenErp XML View" I don't know if there's some wrong tag here, i made this design based on an existing module.

 <record id="student_certificados_form" model="ir.ui.view">
    <field name="name">certificados.result.form</field>
    <field name="model">certificados.certificados</field>
    <field name="arch" type="xml">
        <form string="Introducir los datos" version="7.0">
        <sheet>
            <div class="oe_edit_only">
                <label for="Registro_Numero" class="oe_inline"/>
            </div>
            <h1>
                <field name="Registro_Numero" class="oe_inline"/>

            </h1>
            <group>
                <group>
                    <field name="Fecha_de_Emision"/>
                    <field name="Fecha_de_Solicitud"/>
                </group>
                <group>
                    <field name="Fecha_del_Documento"/>
                    <field name="Vigencia"/>
                 </group>
            </group>
            <notebook>
            <page string="Certificados">
                    <field name="Crear Certificado" >
                        <tree string="Certificadu" >
                            <field name="Item" />
                            <field name="Codigo_Arancelario" />
                            <field name="Descripcion_Arancelaria" />
                            <field name="Especificaciones_Tecnicas" />
                            <field name="Precio_Unitario_Declarado" />
                            <field name="Valor_En_Divisas" />
                            <field name="Cantidad_Consumida" />
                            <field name="Cantidad_Disponible" />
                        </tree>
                        <form string="Certificado" version="7.0">
                            <group>
                                <field name="Codigo_Arancelario" />
                                <field name="Especificaciones_Tecnicas"/>
                                <field name="Valor_En_Divisas" />
                            </group>
                        </form>
                    </field>
                <separator string="Certificados"/>
                <field name="Item" readonly="1">
                <tree string="Certificados" >
                    <field name="Codigo_Arancelario" />
                    <field name="Descripcion_Arancelaria" />
                    <field name="Especificaciones_Tecnicas" />
                    <field name="Cantidad" /><field name="Unidad_de_Medida" />
                    <field name="Precio_Unitario_Declarado" /><field name="Moneda" />
                    <field name="Valor_En_Divisas" /><field name="Moneda" />
                    <field name="Cantidad_Consumida" />
                    <field name="Cantidad_Disponible" />
                </tree>
                </field>
            </page>
        </notebook>
    </sheet>
                 <div class="oe_chatter">
          <field name="message_follower_ids" widget="mail_followers"/>
          <field name="message_ids" widget="mail_thread"/>
        </div> 

            </form>
    </field>
</record>

That being the design i took from the other module.

The module.py being like:

class certificados(osv.osv):

_name = 'certificados.certificados'

_columns = {
            'Item' : fields.integer('Item'), 'Registro_Numero' : fields.integer('Registro Numero'),
            'Fecha_de_Emision': fields.date('Fecha de Emision', required=True, select=True),
            'Fecha_de_Solicitud': fields.date('Fecha de Solicitud', required=True, select=True),
            'Fecha_del_Documento': fields.date('Fecha del Documento', required=True, select=True),
            'Vigencia' : fields.integer('Vigencia'), 
            'Codigo_Arancelario' : fields.integer('Codigo Arancelario'),
            'Descripcion_Arancelaria' : fields.char('Descripcion Arancelaria', size=42, required = True, translate = True), 
            'Especificaciones_Tecnicas' : fields.char('Especificaciones Tecnicas', size=60, required = True, translate = True), 
            'Cantidad' : fields.float('Cantidad'), 'Unidad_de_Medida': fields.many2one('product.uom', 'Unidad de Medida'),
            'Precio_Unitario_Declarado' : fields.float('Precio Unitario Declarado'), 'Moneda' : fields.many2one('res.currency', 'Moneda'),
            'Valor_En_Divisas' : fields.float('Valor En Divisas'),
            'Cantidad_Consumida' : fields.float('Cantidad Consumida'), 'Cantidad_Disponible' : fields.float('Cantidad Disponible'),
            'notas' : fields.text('Notas'),
            }
certificados()

I don't think it's a matter of a mismatch or undeclared field in the module.py code.

I'm sure there is something with the xml design, but don't know where.

If anyone could help would be very great.

Thanks in advance!

3

3 Answers

2
votes

In your code many mistakes exits.

1.`<field name="Crear Certificado" >`

The field does not exits in your py code columns. And name of your field in not PEP 8 rule

2. `<field name="Item" readonly="1">`

Item is integer field, I do not understand why you treat this field like one2many and define tree.

3.<div class="oe_chatter">
          <field name="message_follower_ids" widget="mail_followers"/>
          <field name="message_ids" widget="mail_thread"/>
        </div> 

If you want to use this field then you have to inherit _inherit = ['mail.thread', 'ir.needaction_mixin'] in your object

And your structure of xml file is very bad structured please change it. Use four space tab.

Hope this helpful to you, if you want to develop module in openerp then first read developer book of openerp from http://doc.openerp.com and for 7 http://doc.openerp.com/trunk/developers/server/

2
votes

You did use un-necessary xml tags in that form view. Try with this one:

<record id="student_certificados_form" model="ir.ui.view">
            <field name="name">certificados.result.form</field>
            <field name="model">certificados.certificados</field>
            <field name="arch" type="xml">
                <form string="Introducir los datos" version="7.0">
                    <sheet>
                        <div class="oe_edit_only">
                            <label for="Registro_Numero" class="oe_inline"/>
                        </div>
                        <h1>
                            <field name="Registro_Numero" class="oe_inline"/>
                        </h1>
                        <group>
                            <group>
                                <field name="Fecha_de_Emision"/>
                                <field name="Fecha_de_Solicitud"/>
                            </group>
                            <group>
                                <field name="Fecha_del_Documento"/>
                                <field name="Vigencia"/>
                            </group>
                            <group>
                                <field name="Codigo_Arancelario"/>
                                <field name="Descripcion_Arancelaria"/>
                            </group>
                            <group>
                                <field name="Especificaciones_Tecnicas"/>
                                <field name="Cantidad"/>
                            </group>
                            <group>
                                <field name="Precio_Unitario_Declarado"/>
                                <field name="Valor_En_Divisas"/>
                            </group>
                            <group>
                                <field name="Cantidad_Consumida"/>
                                <field name="notas"/>
                            </group>
                        </group>
                    </sheet>
                </form>
            </field>
        </record>

If you want to use 'message_follower_ids' and 'message_ids' at last, showed in form view, you need to inherit 'mail.thread' object.

Thanks, Priyesh Solanki

0
votes

I think you need to study rule to write xml

1) All XML Elements Must Have a Closing Tag 2) XML Tags are Case Sensitive 3) XML Elements Must be Properly Nested 4) XML Documents Must Have a Root Element 5) XML Attribute Values Must be Quoted

http://www.w3schools.com/xml/xml_syntax.asp