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

AssertionError: Element openerp has extra content: data, line 3

By
Jeferson M. Moreira
on 2/2/16, 9:21 PM 1,158 views

I get the following error while trying to install my custom addon module on odoo 9.0, what should I do to fix this?


Odoo Server Error
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 643, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 680, in dispatch
    result = self._call_function(**self.params)
  File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 316, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/service/model.py", line 118, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 309, in checked_call
    result = self.endpoint(*a, **kw)
  File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 959, in __call__
    return self.method(*args, **kw)
  File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 509, in response_wrap
    response = f(*args, **kw)
  File "/usr/lib/python2.7/dist-packages/openerp/addons/web/controllers/main.py", line 896, in call_button
    action = self._call_kw(model, method, args, {})
  File "/usr/lib/python2.7/dist-packages/openerp/addons/web/controllers/main.py", line 884, in _call_kw
    return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/addons/base/module/module.py", line 459, in button_immediate_install
    return self._button_immediate_function(cr, uid, ids, self.button_install, context=context)
  File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/addons/base/module/module.py", line 533, in _button_immediate_function
    registry = openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True)
  File "/usr/lib/python2.7/dist-packages/openerp/modules/registry.py", line 385, in new
    openerp.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 338, in load_modules
    loaded_modules, update_module)
  File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 237, in load_marked_modules
    loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
  File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 156, in load_module_graph
    _load_data(cr, module_name, idref, mode, kind='data')
  File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 98, in _load_data
    tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
  File "/usr/lib/python2.7/dist-packages/openerp/tools/convert.py", line 852, in convert_file
    convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
  File "/usr/lib/python2.7/dist-packages/openerp/tools/convert.py", line 926, in convert_xml_import
    relaxng.assert_(doc)
  File "lxml.etree.pyx", line 3375, in lxml.etree._Validator.assert_ (src/lxml/lxml.etree.c:166410)
AssertionError: Element openerp has extra content: data, line 3
1

Jignesh Mehta

--Jignesh Mehta--
2087
| 6 4 8
Surat, India
--Jignesh Mehta--


Jignesh Mehta
On 2/3/16, 1:58 AM

Hello Jeferson,


In your XMl file, there is an extra tag. So it gives error as extra content. Please Check your XML file.


UPDATE:-

Remove the <data></data> tag and try <odoo></odoo> tag instead of <openerp></openerp> tag.

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

<odoo>

     // Your XML File

</odoo>


Thanks,

Hi, it should works fine with current tags

Ahmed M.Elmubarak
on 2/3/16, 7:14 AM
0
rock_solid
On 8/24/16, 4:31 AM

 there is not only extra tag can cause the problem,but also some misstyping , open the xml file with IE  and you'll find the extra content easily,then delete it  

0

Ahmed M.Elmubarak

--Ahmed M.Elmubarak--
2988
| 5 3 5
Sudan
--Ahmed M.Elmubarak--


Ahmed M.Elmubarak
On 2/3/16, 7:13 AM

Hi,

I think your code has a lot of issues. But I think the one which generated this error is that you're putting the <button> field out side the <tree tag 

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<!-- ORDER VIEW TO LIST EMPLOYEE AND MANAGER ORDERS -->
<record model="ir.ui.view" id="my_order_tree_view">
<field name="name">order.tree</field>
<field name="model">helpdesk.order</field>
<field name="arch" type="xml">
<tree string="My Orders">
<field name="name" domain="['&amp;',('partner_id','=',user.partner_id.id), ('company_id','=',user.partner_id.company_id.id)]"/>
<field name="state" domain="['&amp;',('partner_id','=',user.partner_id.id), ('company_id','=',user.partner_id.company_id.id)]"/>
</tree>
</field>
<button string="New Order" name="%(action_order_form_view)d" type="action"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">Create the first order</p>
</field>
</record>



Try to remove or comment this line and try again ...
0
Jeferson M. Moreira
On 2/3/16, 6:13 AM

@Dep and @Jignesh I checked my code and I can't find any extra tag or close tag missing. I understand through the log that this problem is because of <data></data>, but this doesn't make sense. Please can someone look at my code and help me.


<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<!-- ORDER VIEW TO LIST EMPLOYEE AND MANAGER ORDERS -->
<record model="ir.ui.view" id="my_order_tree_view">
<field name="name">order.tree</field>
<field name="model">helpdesk.order</field>
<field name="arch" type="xml">
<tree string="My Orders">
<field name="name" domain="['&amp;',('partner_id','=',user.partner_id.id), ('company_id','=',user.partner_id.company_id.id)]"/>
<field name="state" domain="['&amp;',('partner_id','=',user.partner_id.id), ('company_id','=',user.partner_id.company_id.id)]"/>
</tree>
</field>
<button string="New Order" name="%(action_order_form_view)d" type="action"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">Create the first order</p>
</field>
</record>

<record model="ir.actions.act_window.view" id="action_my_order_tree_view">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="my_order_tree_view"/>
<field name="act_window_id" ref="action_my_order_tree_view"/>
</record>

<!-- ORDER VIEW TO LIST ALL ORDERS FROM A SPECIFIC COMPANY -->
<record model="ir.ui.view" id="company_order_tree_view">
<field name="name">order.tree</field>
<field name="model">helpdesk.order</field>
<field name="arch" type="xml">
<tree string="Orders">
<field name="name" domain="[('company_id','=',user.partner_id.company_id.id)]"/>
<field name="state" domain="[('company_id','=',user.partner_id.company_id.id)]"/>
</tree>
</field>
<button string="New Order" name="%(action_order_form_view)d" type="action"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">Create the first order</p>
</field>
</record>

<record model="ir.actions.act_window.view" id="action_company_order_tree_view">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="company_order_tree_view"/>
<field name="act_window_id" ref="action_company_order_tree_view"/>
</record>

<!-- ORDER VIEW TO LIST TRACKED ORDERS TO AGENT -->
<record model="ir.ui.view" id="tracked_order_tree_view">
<field name="name">order.tree</field>
<field name="model">helpdesk.track.follow</field>
<field name="arch" typ="xml">
<tree string="Tracked Orders">
<field name="name" domain="[('user_id','=',user.id)]"/>
<field name="state" domain="[('user_id','=',user.id)]"/>
</tree>
</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">Track the first order</p>
</field>
</record>

<record model="ir.actions.act_window.view" id="action_tracked_order_tree_view">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="tracked_order_tree_view"/>
<field name="act_window_id" ref="action_tracked_order_tree_view"/>
</record>

<!-- ORDER VIEW TO LIST OPEN ORDERS TO AGENT -->
<record model="ir.ui.view" id="open_order_tree_view">
<field name="name">order.tree</field>
<field name="model">helpdesk.order</field>
<field name="arch" typ="xml">
<tree string="Open Orders">
<field name="name" domain="[('state','=','open')]"/>
<field name="state" domain="[('state','=','open')]"/>
</tree>
</field>
</record>

<record model="ir.actions.act_window.view" id="action_open_order_tree_view">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="open_order_tree_view"/>
<field name="act_window_id" ref="action_open_order_tree_view"/>
</record>

<!-- ORDER VIEW TO LIST ALL ORDERS -->
<record model="ir.ui.view" id="orders_tree_view">
<field name="name">order.tree</field>
<field name="model">helpdesk.order</field>
<field name="arch" typ="xml">
<tree string="Orders">
<field name="name"/>
<field name="state"/>
</tree>
</field>
</record>

<record model="ir.actions.act_window.view" id="action_orders_tree_view">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="orders_tree_view"/>
<field name="act_window_id" ref="action_orders_tree_view"/>
</record>

<!-- ANSWER ORDER FORM VIEW -->
<record model="ir.ui.view" id="order_form_view">
<field name="name">order.form</field>
<field name="model">helpdesk.answer</field>
<field name="arch" type="xml">
<form string="Order Form">
<header>
<button name="action_open" type="object" groups="employee,company_manager" string="Open" states="open" class="oe_highlight"/>
<button name="action_solved" type="object" groups="employee,company_manager" string="Solved" states="solved" class="oe_highlight"/>
<button name="action_deleted" type="object" groups="company_manager" string="Delete" states="deleted" class="oe_highlight"/>
<button name="action_message" type="object" string="Send message" class="oe_highlight"/>
<button name="action_track" type="object" groups="agents" string="Track" states="tracked" class="oe_highlight" attrs="{'invisible:[('state','=','tracked')]'}"/>
<button name="action_assign" type="object" groups="helpdesk_manager" string="Assign" states="tracked" class="oe_highlight" attrs="{'invisible:[('state','=','tracked')]'}"/>
<field name="state" widget="statusbar"/>
</header>

<sheet>
<group>
<field name="name"/>
<field name="description"/>
<field name="message"/>
</group>
</sheet>
</form>
</field>
</record>

<record model="ir.actions.act_window" id="action_order_form_view">
<field name="name">Order</field>
<field name="res_model">helpdesk.order</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
</record>

<!-- MENU -->
<!-- top level menu: no parent -->
<menuitem id="main_helpdesk_menu" name="HelpDesk"/>

<!-- A first level in the left side menu is needed before using action= attribute -->
<menuitem id="helpdesk_menu" name="HelpDesk" parent="main_helpdesk_menu"/>

<!-- Submenu -->
<menuitem id="my_order_menu" name="My Orders" groups="employee,company_manager" parent="helpdesk_menu" action="action_my_order_tree_view"/>
<menuitem id="company_order_menu" name="Company Orders" groups="company_manager" parent="helpdesk_menu" action="action_company_order_tree_view"/>
<menuitem id="tracked_order_menu" name="Tracked Orders" groups="agents" parent="helpdesk_menu" action="action_tracked_order_tree_view"/>
<menuitem id="open_order_menu" name="Open Orders" groups="agents" parent="helpdesk_menu" action="action_open_order_tree_view"/>
<menuitem id="all_orders_menu" name="All Orders" groups="helpdesk_manager" parent="helpdesk_menu" action="action_orders_tree_view"/>

</data>
</openerp>


Try with my updated code.

Jignesh Mehta
on 2/3/16, 6:26 AM
0

Odoo

--Odoo --
1328
| 5 2 5
kerala, India
--Odoo --

Working as a Odoo Functional and Technical Expert

Odoo
On 2/3/16, 1:58 AM

somewhere you missed to close />  tag (closing tag ) ,add this  or please paste your xml file 

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

1 follower(s)

Stats

Asked: 2/2/16, 9:21 PM
Seen: 1158 times
Last updated: 8/24/16, 4:31 AM