Error when adding a bank account to a partner

Bug #480689 reported by TomazK
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Odoo Web Client
Fix Released
Undecided
Unassigned

Bug Description

I wanted to add a bank account to a partner in the web client (Partner view (Edit) - accounting tab - bank details - 'Create a new record'). In the new window (Bank account) I filled out the form and clicked on 'save'. The record was not added and the system displayed the following error in the Bank account window:

Traceback (most recent call last):
  File "/home/openerp/sources/trunk/server/bin/netsvc.py", line 244, in dispatch
    result = LocalService(service_name)(method, *params)
  File "/home/openerp/sources/trunk/server/bin/netsvc.py", line 73, in __call__
    return getattr(self, method)(*params)
  File "/home/openerp/sources/trunk/server/bin/addons/base_module_record/base_module_record.py", line 38, in execute
    res = super(recording_objects_proxy, self).execute(*args, **argv)
  File "/home/openerp/sources/trunk/server/bin/addons/audittrail/audittrail.py", line 346, in execute
    res = my_fct(db, uid, passwd, object, method, *args)
  File "/home/openerp/sources/trunk/server/bin/addons/audittrail/audittrail.py", line 331, in my_fct
    return fct_src(db, uid, passwd, object, method, *args)
  File "/home/openerp/sources/trunk/server/bin/service/web_services.py", line 583, in execute
    res = service.execute(db, uid, object, method, *args)
  File "/home/openerp/sources/trunk/server/bin/osv/osv.py", line 59, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/openerp/sources/trunk/server/bin/osv/osv.py", line 118, in execute
    res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/openerp/sources/trunk/server/bin/osv/osv.py", line 110, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/openerp/sources/trunk/server/bin/osv/orm.py", line 2516, in write
    result += self._columns[field].set(cr, self, id, field, vals[field], user, context=rel_context) or []
  File "/home/openerp/sources/trunk/server/bin/osv/fields.py", line 446, in set
    id_new = obj.create(cr, user, act[2], context=context)
  File "/home/openerp/sources/trunk/addons-extra/account_payment_extension/payment.py", line 56, in create
    return super(res_partner_bank, self).create(cr, uid, vals, context=context)
  File "/home/openerp/sources/trunk/server/bin/addons/base_iban/base_iban.py", line 43, in create
    return super(res_partner_bank, self).create(cr, uid, vals, context)
  File "/home/openerp/sources/trunk/server/bin/osv/orm.py", line 2615, in create
    default_values = self.default_get(cr, user, default, context)
  File "/home/openerp/sources/trunk/server/bin/osv/orm.py", line 2032, in default_get
    value[f] = self._defaults[f](self, cr, uid, context)
  File "/home/openerp/sources/trunk/server/bin/addons/base/res/partner/partner.py", line 426, in <lambda>
    cursor, user, 'country_id', context=context),
  File "/home/openerp/sources/trunk/server/bin/addons/base/res/partner/partner.py", line 391, in _default_value
    for ham, spam, address in context['address']:
ValueError: too many values to unpack

I checked and the the error does not appear in the GTK client.
I am using OpenERP Version 5.0.6.

Revision history for this message
Sananaz (Open ERP) (sma-tiny) wrote :

hello,

Its fixed in stable as well as trunk version.
Please update your code or take the stable branch.

Thanks.

Changed in openobject-client-web:
status: New → Fix Committed
milestone: none → 5.0.7
Revision history for this message
BostjanG (bostjan-grasic) wrote :

Hi, I have merged from lp:~openerp/openobject-client-web/5.0 and it does not work (if I go to about it still says version 5.0.6).

However, I have tried running from the trunk version and there works ok. Do I have to merge from a different branch than 5.0 (for stable)

Revision history for this message
James Wyson (jmwyson) wrote :

Hi,

I still encounter this error after checking out the latest stable branch (5.0.7).

Revision history for this message
Borja López Soilán (NeoPolus) (borjals) wrote :

Jameson, we had been able to reproduce this problem in the revno 2788 of the web client, but seems to work on the revno 2804.

----

We debugged it a bit, and it seems that the web client was changing the context:

When you open the new bank popup, context looks like this:

{'lang': u'en_US', 'bin_size': True, 'client': 'web', 'tz': False, 'address': [(1, 53, {'function': False, 'city': False, 'fax': False, 'name': u'customer', 'zip': False, 'title': False, 'mobile': False, 'street2': False, 'country_id': (67, u'Espa\xf1a'), 'email': <email address hidden>', 'phone': False, 'street': False, 'state_id': False, 'type': False, 'id': 53})]}

As you can see the address is something like [(<number>, <number>, <dictionary>)]

After saving the record, the context changes to:

{'lang': u'en_US', 'client': 'web', 'tz': False, 'address': {'function': False, 'city': False, 'fax': False, 'name': 'customer', 'zip': False, 'title': False, 'mobile': False, 'street2': False, 'country_id': 67, 'phone': False, 'street': False, 'state_id': False, 'type': False, 'email': '<email address hidden>'}, 'no_store_function': True, 'active_ids': [84], '_terp_view_name': u'Partners', 'active_id': 84}

Now the address has only the dictionary, that's what causes the "too many values to unpack" (it tries to get three values from a tuple, but there is just one).

Anyway, it seems that it has been corrected, though we don't know know what commit did fix it.

Revision history for this message
Sananaz (Open ERP) (sma-tiny) wrote :

Hello,

Revision ID: <email address hidden>
Revision Number: 2784

Sorry for inconvenience.

Changed in openobject-client-web:
status: Fix Committed → Fix Released
Revision history for this message
priyanka (priyankahdp) wrote :

from openerp.osv import fields, osv

class checkroll(osv.osv):
    _name = "checkroll.plucker"
    _description = "This table is for keeping personal data of plucker"
    _columns = {
        'reg_no': fields.char('Registration Number', size=256, required=True),
        'worker_name': fields.char('Worker Name', size=256, required=True),
        'spouse_name': fields.char('Spouse Name', size=256),
        'work':fields.selection([('Plucking', 'Tapping','Sundry'), ('Plucking', 'Tapping','Sundry')], 'Work'),
        'epf_no':fields.char('EPF Number', size=256)
    }
checkroll()

for the above code i also got the same error.
can we use like below.?
        'work':fields.selection([('Plucking', 'Tapping','Sundry'), ('Plucking', 'Tapping','Sundry')], 'Work'),
is it support for the 3 selection items.?or need to change it to 2 items.?

here is my view.xml

<?xml version="1.0"?>
<openerp>
 <data>
  <!-- 1st part of the sim_view start -->
  <record model="ir.ui.view" id="worker_form">
   <field name="name">Worker</field>
   <field name="model">checkroll.plucker</field>
   <field name="type">form</field>
   <field name="arch" type="xml">
    <form string="Worker">
     <field name="reg_no" />
     <field name="worker_name" />
     <field name="spouse_name" />
     <field name="work" />
     <field name="epf_no" />
    </form>
   </field>
  </record>
  <!--2nd part of the sim_view start -->
  <record model="ir.ui.view" id="worker_tree">
   <field name="name">Worker</field>
   <field name="model">checkroll.plucker</field>
   <field name="type">tree</field>
   <field name="arch" type="xml">
    <tree string="Worker">
     <field name="reg_no" />
     <field name="worker_name" />
     <field name="spouse_name" />
     <field name="work" />
     <field name="epf_no" />
    </tree>
   </field>
  </record>
  <!-- 3rd part of the sim_view start -->
  <record model="ir.actions.act_window" id="action_worker">
   <field name="name">Worker</field>
   <field name="res_model">checkroll.plucker</field>
   <field name="view_type">form</field>
   <field name="view_mode">tree,form</field>
  </record>
  <!--4th part of the sim_view start -->
  <menuitem name="Checkroll/Worker/PluckerInfo" id="menu_checkroll_plucker"
   action="action_worker" />
  <!--4th part of the sim_view end -->
 </data>
</openerp>

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) wrote :

You can only have a tuple of 2 items for fields.selection!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.