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

Error associated with views cant resolve it? Is this view code correct/not?

By
Praveen S
on 7/5/13, 9:33 AM 758 views

please verify that my view created for the following module is correct or not.

region.py

from openerp.osv import osv,fields

class region(osv.Model):
    _name = 'region.region'
    _columns = { 
        'name': fields.char('Name', size = 100), 
    'region_rel': fields.one2many('region.region.relation', 'rel_id', 'Region Relation'),
    }

class regionrel(osv.Model):
    _name = 'region.region.relation'
    _columns = { 
    'rel_id': fields.many2one('region.region', 'Region'),
        'country': fields.many2one('res.country', 'Country'), 
        'state': fields.many2one('res.country.state', 'State'), 
    }

region_view.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp> 
    <data> 
        <menuitem id="region_main_menu" name="Regions"/>

        <record id="region_region_tree_view" model="ir.ui.view">
            <field name="name">region.region.tree</field>
            <field name="model">region.region</field>
            <field name="arch" type="xml">
                <tree string="Regions">
                    <field name="name"/>
                </tree>
            </field>
        </record>

        <record id="region_region_form_view" model="ir.ui.view">
            <field name="name">region.region.form</field>
            <field name="model">region.region</field>
            <field name="arch" type="xml">
                <form string="regions" version="7.0">
                    <group colspan="2" col="3">
                        <field name="name"/>
                    </group>
                    <notebook colspan="6">
                        <page string="Region">
                            <field colspan="4" name="region_lines" nolabel="1" widget="one2many_list">
                <tree editable="bottom" colors="red:test in ()">
                                    <field name="country"/>
                    <field name="state"/>
                </tree>
                                <form string="Region">
                                    <field name="country"/>
                                    <field name="state"/>
                                </form>
                            </field>
                        </page>
                    </notebook>
                </form>
            </field>
        </record>

        <record id="region_normal_action" model="ir.actions.act_window">
            <field name="name">region</field>
            <field name="res_model">region.region</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
        </record>

        <menuitem id="section_main_menu" parent="region_main_menu" name = "Region Information"/>

        <menuitem id="region_real_menu" parent="section_main_menu" action="region_normal_action"/>
    </data>
</openerp>
0
Raza Ali
On 7/5/13, 10:18 AM

Your model says region_rel while your view says region_lines

thanks Raza

Praveen S
on 7/6/13, 4:10 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

0 follower(s)

Stats

Asked: 7/5/13, 9:33 AM
Seen: 758 times
Last updated: 3/16/15, 8:10 AM