New custom search bug: argument 2 of QComboBox.addItem() has an invalid type

Bug #608781 reported by Borja López Soilán (NeoPolus)
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KDE OpenObject Client
New
Undecided
Unassigned

Bug Description

The new custom search widget, added on revno 1502, seems to be causing problems on my install. I cannot open any 'tree' view cause the custom widget fails:

Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/Koo/Dialogs/TreeWidget.py", line 294, in open
    self.executeAction( 'tree_but_open', id )
  File "/usr/local/lib/python2.6/dist-packages/Koo/Dialogs/TreeWidget.py", line 287, in executeAction
    Api.instance.executeKeyword(keyword, {'model':self.model, 'id':id, 'report_type':report_type, 'ids': [id]}, self.context)
  File "./Koo/koo.py", line 147, in executeKeyword
    return Koo.Actions.executeKeyword( keyword, data, context )
  File "/usr/local/lib/python2.6/dist-packages/Koo/Actions/Actions.py", line 244, in executeKeyword
    Api.instance.executeAction(action, data, context=context)
  File "./Koo/koo.py", line 144, in executeAction
    Koo.Actions.executeAction( action, data, context )
  File "/usr/local/lib/python2.6/dist-packages/Koo/Actions/Actions.py", line 182, in executeAction
    target=target )
  File "./Koo/koo.py", line 153, in createWindow
    view_type, window, context, mode, name, autoReload, target )
  File "/usr/local/lib/python2.6/dist-packages/Koo/Dialogs/WindowService.py", line 52, in createWindow
    context=context, name=name )
  File "/usr/local/lib/python2.6/dist-packages/Koo/Dialogs/FormWidget.py", line 136, in __init__
    self.screen.setupViews( view_type, view_ids )
  File "/usr/local/lib/python2.6/dist-packages/Koo/Screen/Screen.py", line 169, in setupViews
    self.switchView()
  File "/usr/local/lib/python2.6/dist-packages/Koo/Screen/Screen.py", line 469, in switchView
    self.setView( self.currentView() )
  File "/usr/local/lib/python2.6/dist-packages/Koo/Screen/Screen.py", line 301, in setView
    self.loadSearchForm()
  File "/usr/local/lib/python2.6/dist-packages/Koo/Screen/Screen.py", line 238, in loadSearchForm
    self.searchForm.setup( arch, fields, self.resource, self.group.domain() )
  File "/usr/local/lib/python2.6/dist-packages/Koo/Search/SearchFormWidget.py", line 214, in setup
    self.uiCustomContainer.setup( fields, domain )
  File "/usr/local/lib/python2.6/dist-packages/Koo/Search/CustomSearchFormWidget.py", line 296, in setup
    self.addItem()
  File "/usr/local/lib/python2.6/dist-packages/Koo/Search/CustomSearchFormWidget.py", line 265, in addItem
    filterItem.setup( self.fields )
  File "/usr/local/lib/python2.6/dist-packages/Koo/Search/CustomSearchFormWidget.py", line 116, in setup
    self.uiField.addItem( field[1], field[0] )
TypeError: argument 2 of QComboBox.addItem() has an invalid type

Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote : Re: [Bug 608781] [NEW] New custom search bug: argument 2 of QComboBox.addItem() has an invalid type

A Dijous, 22 de juliol de 2010, Borja López Soilán (Pexego) va escriure:
> "/usr/local/lib/python2.6/dist-packages/Koo/Search/CustomSearchFormWidget.p
> y", line 116, in setup self.uiField.addItem( field[1], field[0] )
> TypeError: argument 2 of QComboBox.addItem() has an invalid type

It works for me, what's the value of field[0]?

--
Albert Cervera i Areny
http://www.NaN-tic.com
OpenERP Partners
Mòbil: +34 669 40 40 18

http://twitter.com/albertnan
http://albert-nan.blogspot.com

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

In the case I try to open the partners list, then 'field' is the tuple ('property_account_payable', u'Account Payable'), if I try to open the partner addresses, then 'field' is the tuple ('type', u'Address Type').
So field[0] is always a string with the name of the field.

It seems that (at least with my PyQT version: python-qt4 4.4.4-2ubuntu6 jaunty) addItem does not allow the second argument to be a string, but requires it to be a QVariant instead:

ipdb> self.uiField.addItem( 'Title', 'type' )
*** TypeError: argument 2 of QComboBox.addItem() has an invalid type
ipdb> self.uiField.addItem( 'type' )
None
ipdb> self.uiField.addItem('Title', QVariant('type'))
None

Maybe on newer versions of PyQT the string to QVariant conversion is automatic (thus it works for you) but needs to be done explicitly on older versions like the one included on Ubuntu 9.04 / Mint 7.

I'm attaching a patch that seems to solve the problem.

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.