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

Why doesn't this view work?

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

--Axel Mendoza--
10318
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

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

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: 9/23/15, 4:42 AM
Seen: 492 times
Last updated: 9/25/15, 4:52 AM