Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

cant solve this error - ValidateError Error occurred while validating the field(s) arch: Invalid XML for View Architecture!

By
Praveen S
on 7/3/13, 8:31 AM 2,431 views

*__init__.py*

import person

__openerp__.py

{
    'name': 'Person Data Storage',
    'version': '2.0',
    'author': 'Praveen',
    'depends': ['base'],
    'data': [  # data files to load at module install
        'view/menu.xml',  
    ], 
    'demo': [],  # demo data (for unit tests)
} 

person.py

from osv import osv, fields

    class person(osv.Model):
        _name = 'person.person'
        _columns = 
{
                       'name': fields.char('Name', size = 100), 
                       'dob': fields.date('Date of birth'),
                       'father_name': fields.char('Father Name', size = 100),
}
     person()

menu.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
       <menuitem id="person_main_menu" name="Persons"/>



     <record id="person_person_tree_view" model="ir.ui.view">
        <field name="name">person.person.tree</field>
        <field name="model">person.person</field>
        <field name="type">tree</field>
        <field name="arch" type="xml">
            <tree string="Persons">
                <field name="name"/>
                <field name="dob"/>
                <field name="father_name"/>
            </tree>
        </field>
    </record>

    <record id="person_person_form_view" model="ir.ui.view">
        <field name="name">person.person.form</field>
        <field name="model">person.person</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form string="Persons">
                <field name="name"/>
                <field name="dob"/>
                <field name="father_name"/>
            </form>
        </field>
    </record>

    <record id="person_normal_action" model="ir.actions.act_window">
        <field name="name">Person</field>
        <field name="res_model">person.person</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
    </record>

    <menuitem id="section_main_menu" parent="person_main_menu" name = "View"/>
        <menuitem id="person_real_menu" parent="section_main_menu" action="person_normal_action"/>

    </data>
</openerp>
1

Ghanshyam Prajapati

--Ghanshyam Prajapati--
1377
| 4 4 8
Pune, India
--Ghanshyam Prajapati--
OpenERP Developer
Ghanshyam Prajapati
On 7/3/13, 8:55 AM

Hey Praveen,

are you working in OpenERP 7 version??, If yes then you should do following changes,

  • Remove <field name="type">form</field> from form view.

  • Replcae <form string="Persons"> with <form string="Persons" version="7.0">

  • Replace from osv import osv, fields with from openerp.osv import osv, fields

from openerp.osv import osv, fields

person.py

class person(osv.Model):
    _name = 'person.person'
    _columns = {
       'name': fields.char('Name', size = 100), 
       'dob': fields.date('Date of birth'),
       'father_name': fields.char('Father Name', size = 100),
}

menu.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <menuitem id="person_main_menu" name="Persons"/>

         <record id="person_person_tree_view" model="ir.ui.view">
            <field name="name">person.person.tree</field>
            <field name="model">person.person</field>
            <field name="arch" type="xml">
                <tree string="Persons">
                    <field name="name"/>
                    <field name="dob"/>
                    <field name="father_name"/>
                </tree>
            </field>
        </record>

        <record id="person_person_form_view" model="ir.ui.view">
            <field name="name">person.person.form</field>
            <field name="model">person.person</field>
            <field name="arch" type="xml">
                <form string="Persons" version="7.0">
                    <group>
                        <field name="name"/>
                        <field name="dob"/>
                        <field name="father_name"/>
                    </group>
               </form>
            </field>
        </record>

        <record id="person_normal_action" model="ir.actions.act_window">
            <field name="name">Person</field>
            <field name="res_model">person.person</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
        </record>

        <menuitem id="section_main_menu" parent="person_main_menu" name = "View"/>
        <menuitem id="person_real_menu" parent="section_main_menu" action="person_normal_action"/>

    </data>
</openerp>

Hope it work for you.

thanks Ghanshyam Prajapati for your replay the same error occurs after replacing all of the above

Praveen S
on 7/3/13, 9:00 AM

Hi Praveen, if my answer solved your problem, then please mark this answer as solved, Thanks.

Ghanshyam Prajapati
on 7/3/13, 9:03 AM

have you updated your module, after made changes?? please restart your server and then update your module.

Ghanshyam Prajapati
on 7/3/13, 9:09 AM

same error occurs when me try to install this module after replacing all of the above fields

Praveen S
on 7/3/13, 9:12 AM

Hey Praveen I installed your module with my changes and its working fine. See my updated answer

Ghanshyam Prajapati
on 7/3/13, 9:28 AM

but it doesn't work for me pls share your work files

Praveen S
on 7/3/13, 9:34 AM

https://www.dropbox.com/s/fhor2fx6blp8onr/test_module.zip download my module. and please mark my answer as solved if your problem is solved, Thanks. :)

Ghanshyam Prajapati
on 7/3/13, 9:50 AM

Your module was successfully working. But i didn't find the error in my module. If you know it pls help me.

Praveen S
on 7/5/13, 4:13 AM
0
Alec Mouti
On 7/3/13, 1:03 PM

I have been having that error problem for weeks now. I changed the view as suggested by many still no luck. I even removed openerp and installed the current release. I hope this thread can find solution to my problem.

is it worked for u

Praveen S
on 7/4/13, 5:52 AM

No, It did not work. I believe there is something else that is causing this error apart from xml views. example, I managed to install custom hotel management module in earlier opener 7.0 releases without problem. I then removed openerp and reinstalled the stable openerp 7.0 release. now I cannot install the same custom Hotel module because of this error. nothing has change regarding custom Module. this tells me that the problem might be a bug. thus why Ghanshyam Prajapati can install the same module while you cannot

Alec Mouti
on 7/4/13, 8:21 AM

Hi Alec Mouti, I got the solution when me deleted all the data regarding to the current module,delete the module from add ones and restarted the server. Then i copied the module to addone and updated then installed. Its now working. Hopes it will helps you too

Praveen S
on 7/5/13, 5:31 AM

I installed the same module with the updated code as a new module.But my issue is the module is not shown in the Installed Modules list though it is there in the addons folder of my openerp 7.What can be done to resolve this issue

sneha antony
on 2/28/14, 6:17 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 7/3/13, 8:31 AM
Seen: 2431 times
Last updated: 3/16/15, 8:10 AM