Skip to Content
Menu
This question has been flagged
3 Replies
2398 Views

Hi, I'm trying to get a really basic view up and running on Odoo V8. My model looks like this;


class routing_country(models.Model):

    _name = 'routing.country'

    name= fields.Char(string='Country Name', required=True)

    alpha_2= fields.Char(string='Alpha 2', required=True)

    alpha_3= fields.Char(string='Alpha 3', required=True)

    numeric= fields.Char(string='Numeric')


My view looks like this;


<record id="routing_country_action" model="ir.actions.act_window">

    <field name="name">Countries</field>

    <field name="res_model">routing.country</field>

    <field name="view_type">form</field>

    <field name="view_mode">tree,form</field>

    <field name="help" type="html">

        <p class="oe_view_nocontent_create">Click Create to add a new country.</p>

        </field>

</record>

<record id="routing_country_tree_view" model="ir.ui.view">

    <field name="name">routing.country.tree.view</field>

    <field name="model">routing.country</field>

    <field name="arch" type="XML">

        <tree string="Country">

            <field name="name"/>

            <field name="alpha_2"/>

            <field name="alpha_3"/>

            <field name="numeric"/>

        </tree>

    </field>

</record>


If I remove the second <record> everything works as expected and I see the country name only in tree view. When I add the second record to give me a tree view with the extra attributes, I get this on install;

File "lxml.etree.pyx", line 3313, in lxml.etree._Validator.assert_ (src/lxml/lxml.etree.c:159862)

AssertionError: Element field has extra content: tree, line 19

I've followed the syntax at https://www.odoo.com/documentation/8.0/howtos/backend.html and tried all sorts of variations, but no joy.

Avatar
Discard
Author

Ok. figured it out...FINALLY..! The has be to . Lower case..!

Author

Tried to paste some XML in, but it didn't work. The type attribute for "arch" must be "xml", not "XML".

Best Answer

I don't see anything inusual except that this line:

<field name="arch" type="XML">

should be:

<field name="arch" type="xml">

With a lowercase xml value

Avatar
Discard
Author

Just discovered that that was the problem. Thanks..!

You should upvote and accept it as an answer then!

Related Posts Replies Views Activity
5
Aug 24
42983
2
Apr 24
950
3
Jun 23
3147
2
Jun 23
2384
3
Mar 23
8630