0
votes

when I try to install this module in OpenERP I get the following error:

"Error occurred while validating the field(s) arch: Invalid XML for View Architecture!"

Would some of you be so kind to tell me what is wrong? here is my .xml code:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>

        <record model="ir.ui.view" id="pec_email_field">
            <field name="name">pec.email.field</field>
            <field name="model">my.partner</field>
            <field name="inherit_id" ref="base.view_partner_form"/>
            <field name="arch" type="xml">
                <field name="email" position="after">
                   <field name="pec_email" string="Certified email adress" type="object"/>
                </field>        
            </field>
        </record> 
    </data>
</openerp>

and here is my .py file

from osv import osv, fields

class my_partner(osv.osv):

    _inherit = "res.partner"
    _name = "my.partner"
    _columns = {'pec_email': fields.char('PEC Email', size=30, required=False) }

my_partner()

thanks

4
need to replace model name my.partner with res.partner. This will solve your problem.Bhavesh Odedra
can you show your .py file that field "pec_email" need to see it?Bhavesh Odedra

4 Answers

0
votes

what a mistable done by you is, you have inherit base.view_partner_form and in model you going to use my.partner, you should inherit object res.partner and added in model res.partner

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>

        <record model="ir.ui.view" id="pec_email_field">
            <field name="name">pec.email.field</field>
            <field name="model">res.partner</field>
            <field name="inherit_id" ref="base.view_partner_form"/>
            <field name="arch" type="xml">
                <field name="email" position="after">
                   <field name="pec_email" string="Certified email adress" type="object"/>
                </field>        
            </field>
        </record> 
    </data>
</openerp>

add like this way

regards,

0
votes

Here is the correct code,you can use type for button only

    <record model="ir.ui.view" id="pec_email_field">
        <field name="name">pec.email.field</field>
        <field name="model">my.partner</field>
        <field name="inherit_id" ref="base.view_partner_form"/>
        <field name="arch" type="xml">
            <field name="email" position="after">
               <field name="pec_email" string="Certified email adress"/>
            </field>        
        </field>
    </record> 
</data>

0
votes

check that you have inherited res.partner to my.partner in your py file and you have wrongly used attribute of button to field tag. check this, this will give you idea regading attributes of field tag. https://doc.openerp.com/6.0/developer/5_16_data_serialization/xml_serialization/ So improve this ,

<field name="pec_email" string="Certified email adress"/>

Hope this will help you.

0
votes

When you inherit a model to new one, then you have to define new view for the new one. You cannot inherit the view of that model. Here you are inheriting the view defined for res.partner. Please create a new view for my.partner