Odoo Help


v7: new/custom module failure due to arcane XML view issue

Falilou DIOP
on 2/17/13, 8:47 PM 2,084 views

Hi all,

While attempting to build a custom module in v7 (to learn the dev tool/cycle), I got past the custom module registering and being installed inside OpenERP, showing up on the main menu bar and all. But when I attempt to click on the menu item hoping to display the form when I can enter data for my module, I got stuck with this very arcane error:

    Client Traceback (most recent call last):
  File "C:\Program Files (x86)\OpenERP7\Server\server\openerp\addons\web\http.py", line 195, in dispatch
  File "C:\Program Files (x86)\OpenERP7\Server\server\openerp\addons\web\controllers\main.py", line 1367, in load
  File "C:\Program Files (x86)\OpenERP7\Server\server\openerp\addons\web\session.py", line 43, in proxy
  File "C:\Program Files (x86)\OpenERP7\Server\server\openerp\addons\web\session.py", line 31, in proxy_method
  File "C:\Program Files (x86)\OpenERP7\Server\server\openerp\addons\web\session.py", line 104, in send

Server Traceback (most recent call last):
  File "C:\Program Files (x86)\OpenERP7\Server\server\openerp\addons\web\session.py", line 90, in send
  File "C:\Program Files (x86)\OpenERP7\Server\server\.\openerp\netsvc.py", line 295, in dispatch_rpc
  File "C:\Program Files (x86)\OpenERP7\Server\server\.\openerp\service\web_services.py", line 614, in dispatch
  File "C:\Program Files (x86)\OpenERP7\Server\server\.\openerp\osv\osv.py", line 169, in execute_kw
  File "C:\Program Files (x86)\OpenERP7\Server\server\.\openerp\osv\osv.py", line 123, in wrapper
  File "C:\Program Files (x86)\OpenERP7\Server\server\.\openerp\osv\osv.py", line 179, in execute
  File "C:\Program Files (x86)\OpenERP7\Server\server\.\openerp\osv\osv.py", line 166, in execute_cr
  File "C:\Program Files (x86)\OpenERP7\Server\server\.\openerp\osv\orm.py", line 3604, in read
  File "C:\Program Files (x86)\OpenERP7\Server\server\.\openerp\osv\orm.py", line 3724, in _read_flat
  File "C:\Program Files (x86)\OpenERP7\Server\server\.\openerp\osv\fields.py", line 1131, in get
  File "C:\Program Files (x86)\OpenERP7\Server\server\openerp\addons\base\ir\ir_actions.py", line 211, in _search_view
  File "C:\Program Files (x86)\OpenERP7\Server\server\.\openerp\osv\orm.py", line 2260, in fields_view_get
  File "C:\Program Files (x86)\OpenERP7\Server\server\.\openerp\osv\orm.py", line 1912, in __view_look_dom_arch
  File "C:\Program Files (x86)\OpenERP7\Server\server\.\openerp\osv\orm.py", line 3533, in fields_get
ValueError: too many values to unpack

I read that this exception occursthat you are trying to unpack a tuple, but the tuple has too many values with respect to the number of target variables. Looking at the error stack, i opened orm.py and went to line 3533 to see and found that "offending line" (line nbr 3533) in the fields_get() method is a "simple" FOR loop as in:

for key, val in sel:
   val2 = None
   if val:
      val2 = translation_obj._get_source(cr, user, self._name + ',' + f, 'selection',  context['lang'], val)
   sel2.append((key, val2 or val))

Below is the code for this module:

in __openerp__.py:

    "name" : "Test Module",
    "version" : "0.1-2013_02_17_4:00PM",
    "author" : "Tstr",
    "category" : "Generic Modules/Others",
    "depends" : ["base"],
    "description" : "Test OpenERP7 Module",
    "data" : ['test_view.xml'],
    "application": True,
    "active": True,
    "installable": True,

in test.py:

from osv import fields, osv

class test(osv.osv):
    _name = "test"
    _description = "This table is for storing test data in the back-end database"
    _columns = {
        'fname': fields.char('First Name', size=256,required=True),
        'lname': fields.char('Last name', size=256,required=True),
        'title': fields.char('Title', size=256,required=True),
        'gender': fields.selection([('male','Male','M'),('female','Female','F')],'Gender'),
        'fnumber': fields.char('Phone Number', size=256),


in test_view.xml:

  <?xml version="1.0" encoding="utf-8"?>
        <record model="ir.ui.view" id="test_form_view">
            <field name="nom">Test Form</field>
            <field name="model">test</field>
            <field name="arch" type="xml">
            <form string="Person">
                <field name="fname"/>
                <field name="lname"/>
                <field name="title"/>
                <field name="gender"/>
                <field name="fnumber"/>

        <record model="ir.actions.act_window" id="test_action">
            <field name="nom">Test Action</field>
            <field name="res_model">test</field>
            <field name="view_type">form</field>
            <field name="view_mode">kanban,form</field>

        <menuitem name="Test Main" id="mn_lvl1"/>
        <menuitem name="Test Menu Level 2" id="mn_lvl2" parent="mn_lvl1"/>
        <menuitem action="test_action" id="mn_lvl3" name="Test Menu Level 3" parent="mn_lvl2"/>

Any help to ascertain why this errors is occurring and what would be a solution to fix it?


Guewen Baconnier - Software Developer, Camptocamp

--Guewen Baconnier - Software Developer, Camptocamp--

| 6 7 8
Lausanne, Switzerland
--Guewen Baconnier - Software Developer, Camptocamp--

Guewen works at Camptocamp as an Odoo developer since 2010. He is the lead developer of the Odoo Connector framework and the Magento Connector. He is a delegate member of the OCA, a committer and an active contributor to the OCA projects.


Guewen Baconnier - Software Developer, Camptocamp
On 2/18/13, 3:20 AM

In your file test.py, the definition of the fields.selection is wrong.

A selection item has only 2 items, not 3. Replace your gender field by:

'gender': fields.selection([('male', 'Male'),('female', 'Female')], 'Gender'),
Falilou DIOP
On 2/18/13, 3:57 AM

Thanks Guewen, changing the selection content items to 2 fixed it. Also I had to remove kanban from the view_mode to this:

    <record model="ir.actions.act_window" id="test_action">
        <field name="nom">Test Action</field>
        <field name="res_model">test</field>
        <field name="view_type">form</field>
        <field name="view_mode">form</field>

OpenERP complained that kanban was not a defined view. I went and review the docs and suffices it to say that I wish they were a bit clearer.

Thanks anyway and may you be blessed as many times as snow flakes during perfectly snowy winter night, in warm comfort.

view mode can be tree, form tree,form

Atchuthan - Technical Consultant, Sodexis Inc
on 7/15/14, 12:45 AM



| 5 5 6
Colombo, Sri Lanka
Java Developer ORACLE Python J2EE Spring Hibernate Struts & Jquery............. :-)
On 3/11/13, 7:33 AM

it means


supports only for two item selections.?

because when add 3 items to the selection field i also got same error in my module..

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.


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)


Asked: 2/17/13, 8:47 PM
Seen: 2084 times
Last updated: 3/16/15, 8:10 AM