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

Problem with selection field

By
Praveen S
on 7/4/13, 5:49 AM 2,020 views

Hi, i am new to openerp. when i am trying to add a selection field in my module,it will not generate any error but the selection drop-down is not displaying.But the label Type and separator are displayed.

My files are here

__init__.py

import region

__openerp__.py

{
    'name': 'Region information',
    'version': '2.0',
    'author': 'Praveen',
    'depends': ['base'],
    'data': [  # data files to load at module install
        'region_view.xml',  
    ], 
    'demo': [],  # demo data (for unit tests)
}

region.py

from openerp.osv import osv, fields

class region(osv.Model):
    _name = 'region.region'
    _columns = {
       'name': fields.char('Name', size = 100), 
    'type': fields.selection([('country','Country'),('state','State')],'Type'),  
}

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"/>
                <field name="type"/>
            </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 col="4" colspan="4">
                    <field name="name"/>
                    <field name="type"/>
                </group>
           </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>
1

Ghanshyam Prajapati

--Ghanshyam Prajapati--
1377
| 4 4 8
Pune, India
--Ghanshyam Prajapati--
OpenERP Developer
Ghanshyam Prajapati
On 7/4/13, 6:50 AM

Hi, i have installed your module, it works perfectly,

Try to update your module through following,

./openerp-server --addons-path=../addons/,../openerp-web/addons/ -d your_db_name -u your_module_name

i cant get it .how to update like this .Pls give me a detailed description and kindly give the files that worked perfectly in your system.

Praveen S
on 7/4/13, 6:58 AM

Your code is ok, just update your module. If you are using ubuntu operating system then, go to terminal >> paste above line, here ../addons/,../openerp-web/addons/ is your addons path. second way Go to Settings >> Modules >> Installed Modules. Now search your module and update it.

Ghanshyam Prajapati
on 7/4/13, 7:02 AM

i am using windows 8 how to do this in windows 8

Praveen S
on 7/4/13, 7:19 AM

Go to Settings >> Modules >> Installed Modules. Now remove installed from search and type name of your module and search it, after searching click on your module and upgrade it.

Ghanshyam Prajapati
on 7/4/13, 7:24 AM

i do this but the same will happens .Not displaying the selection drop-down but its label "type" was displayed

Praveen S
on 7/4/13, 7:28 AM

Will you pls give the files that successfully worked in your system

Praveen S
on 7/4/13, 7:36 AM

hello Ghanshyam Prajapati
Will you pls give the files that successfully worked in your system

Praveen S
on 7/4/13, 7:50 AM

Do you remember i gave you link of my module(Previous Question), Is it worked for you??

Ghanshyam Prajapati
on 7/4/13, 7:54 AM

yes that code worked for me but my module doesn't worked when we made such changes

Praveen S
on 7/4/13, 9:11 AM

https://www.dropbox.com/s/1n2kx2cvpp3bpyr/test_module_new.zip download my module. and please mark my both answer as solved if it worked for you. Thanks

Ghanshyam Prajapati
on 7/4/13, 9:41 AM

thanks Ghanshyam Prajapati your code works perfetly. But i didn't solve it my code. Are you know anything about my coding problem? If you know please help me....

Praveen S
on 7/5/13, 3:57 AM
0

Grover Menacho

--Grover Menacho--
2523
| 5 7 8
La Paz, Bolivia
--Grover Menacho--

Systems Engineer + MBA

Grover Menacho
On 7/4/13, 2:29 PM

Hello.

Delete your fields.selection and insert this:

'type': fields.selection((('country','Country'),('state','State')),'Type'),

It should work.

thanks Grover for your replay, but its not working.

Praveen S
on 7/5/13, 4:03 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: 7/4/13, 5:49 AM
Seen: 2020 times
Last updated: 3/16/15, 8:10 AM