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 every form I create from zero (without inheritance) is not showing up? [Closed]

By
Juan Formoso
on 10/23/14, 10:52 AM 547 views

The Question has been closed for reason: not relevant or out dated

by
Juan Formoso
on 10/23/2014 11:58:52

I created a lot of forms and trees for several models which have been created by me from zero (no inheritances). The trees are showing up great, but the problem is that I can never see the form, instead I am seeing a kind of auto-generated form with all the fields of my models ordered ramdomly.

Let's put an example:

I have created a model, called res.country.region. Here the code:

class res_country_region(orm.Model):
    _name = 'res.country.region'
    _columns = {
        'code': fields.char('Code', size=2, required=True),
        'name': fields.char('Name', size=64, required=True),
        'country_id': fields.many2one('res.country', 'Country',
                                      required=True),
    }

res_country_region()

And then, I created its XML view, with its form view, its tree view, the actions and the position in the menu. The menu button is in the place I have indicated, when I click on this, I see the tree I specified, but if I turn the view to form, a form is shown, but different from the one I specified, ignoring my own definitions. And it is happening with every model I create. Here is my XML view code:

<record id="res_country_region_view" model="ir.ui.view">
            <field name="name">res.country.region.form</field>
            <field name="model">res.country.region</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Region" version="7.0">
                    <group>
                        <group>
                            <field name="name"/>
                            <field name="code"/>
                        </group>
                        <group>
                            <field name="country_id" options='{"no_open": True}'/>
                        </group>
                    </group>
                </form>
            </field>
        </record>

        <record id="res_country_region_view" model="ir.ui.view">
            <field name="name">res.country.region.tree</field>
            <field name="model">res.country.region</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Regions">
                    <field name="name"/>
                    <field name="code"/>
                    <field name="country_id" options='{"no_open": True}'/>
                </tree>
            </field>
        </record>

        <record id="res_country_region_act" model="ir.actions.act_window">
            <field name="name">Regions</field>
            <field name="res_model">res.country.region</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="res_country_region_view"/>
            <field name="help" type="html">
              <p class="oe_view_nocontent_create">
                Click to define a new region.
              </p><p>
                Use regions to create new places inside each country which can
                include a group of states.
              </p>
            </field>
        </record>

        <menuitem action="res_country_region_act"
            id="menu_res_country_region_act" sequence="0"
            parent="base.menu_localisation" groups="base.group_no_one"/>

 Why is it happening this? What am I doing wrong? Any help will be appreciated a lot. Thank you!

NOTE: I edited my post because I thought my trees were wrong, but they are OK. The problems are only with my forms.

0
Juan Formoso
On 10/23/14, 11:58 AM

Stupid error. I wrote the same ID for tree and form.

About This Community

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

Question tools

1 follower(s)

Stats

Asked: 10/23/14, 10:52 AM
Seen: 547 times
Last updated: 3/16/15, 8:10 AM