Odoo Help

0

Why doesn't this view work?

By
Michael Scorpio
on 9/23/15, 4:42 AM 686 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.

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

Michael Scorpio
on 9/23/15, 12:01 PM

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

Michael Scorpio
on 9/23/15, 12:02 PM
2
Axel Mendoza
On 9/23/15, 12:04 PM

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

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

Michael Scorpio
on 9/23/15, 12:17 PM

You should upvote and accept it as an answer then!

Ermin Trevisan
on 9/25/15, 4:53 AM

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 9/23/15, 4:42 AM
Seen: 686 times
Last updated: 9/25/15, 4:52 AM