← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 721894] Re: [Trunk][survey] Matrix of Choices (Multiple Answers Per Row) broken; patch included

 

** Changed in: openobject-addons
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/721894

Title:
  [Trunk][survey] Matrix of Choices (Multiple Answers Per Row) broken;
  patch included

Status in OpenERP Modules (addons):
  Fix Released

Bug description:
  Hello, this is 6.0.1 with addons revno 4417
  Create a survey with a question of kind "Matrix of Choices (Multiple Answers Per Row)"
  When playing the survey you'll get this error:

  
  [2011-02-19 17:41:14,815][survey] ERROR:db.cursor:Programming error: can't adapt type 'browse_record', in query SELECT survey_question_column_heading.in_visible_menu_choice,survey_question_column_heading.title,survey_question_column_heading.rating_weight,survey_question_column_heading.in_visible_rating_weight,survey_question_column_heading.menu_choice,survey_question_column_heading.question_id,survey_question_column_heading.id FROM "survey_question_column_heading" WHERE survey_question_column_heading.id IN %s ORDER BY id
  [2011-02-19 17:41:14,815][survey] ERROR:web-services:Uncaught exception
  Traceback (most recent call last):
    File "/home/rvalyi/DEV/openerp/server/bin/osv/osv.py", line 122, in wrapper
      return f(self, dbname, *args, **kwargs)
    File "/home/rvalyi/DEV/openerp/server/bin/osv/osv.py", line 176, in execute
      res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    File "/home/rvalyi/DEV/openerp/server/bin/osv/osv.py", line 167, in execute_cr
      return getattr(object, method)(cr, uid, *args, **kw)
    File "/home/rvalyi/DEV/openerp/addons/survey/wizard/survey_answer.py", line 245, in fields_view_get
      for col in que_col_head.read(cr, uid, que_rec.column_heading_ids):
    File "/home/rvalyi/DEV/openerp/server/bin/osv/orm.py", line 2940, in read
      result = self._read_flat(cr, user, select, fields, context, load)
    File "/home/rvalyi/DEV/openerp/server/bin/osv/orm.py", line 2999, in _read_flat
      cr.execute(query, (tuple(sub_ids),))
    File "/home/rvalyi/DEV/openerp/server/bin/sql_db.py", line 78, in wrapper
      return f(self, *args, **kwargs)
    File "/home/rvalyi/DEV/openerp/server/bin/sql_db.py", line 131, in execute
      res = self._obj.execute(query, params)
    File "/usr/lib/python2.6/dist-packages/psycopg2/extensions.py", line 120, in getquoted
      pobjs = [adapt(o) for o in self._seq]
  ProgrammingError: can't adapt type 'browse_record'

  
  This is solved by the first part of the patch that properly create the table of ids in the for.
  If you continue to use read, you'll then get this error:

  
  [2011-02-19 17:46:00,063][survey] ERROR:web-services:Uncaught exception
  Traceback (most recent call last):
    File "/home/rvalyi/DEV/openerp/server/bin/osv/osv.py", line 122, in wrapper
      return f(self, dbname, *args, **kwargs)
    File "/home/rvalyi/DEV/openerp/server/bin/osv/osv.py", line 176, in execute
      res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    File "/home/rvalyi/DEV/openerp/server/bin/osv/osv.py", line 167, in execute_cr
      return getattr(object, method)(cr, uid, *args, **kw)
    File "/home/rvalyi/DEV/openerp/addons/survey/wizard/survey_answer.py", line 246, in fields_view_get
      etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que.id) + "_" + tools.ustr(row.id) + "_" + tools.ustr(col.id), 'nolabel':"1"})
  AttributeError: 'dict' object has no attribute 'id'

  
  This is fixed by replacing read by browse in the same patch.

  Guys I doubt this had ever been tested by who did it...

  So please apply the attached patch. Aside from that kudos for that
  wonderful survey module.



References