Somesh Khare has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-17571-skh into 
lp:openobject-addons/6.0.

Requested reviews:
  Raphael Collet (OpenERP) (rco-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-17571-skh/+merge/76156

Hello,

[IMP] : When Creating a new question for the survey page gives the TypeError: 
object of type 'int' has no len() only in the webclient.

I have back-ported the code from the trunk Revision : 5099. 

Thanks.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-17571-skh/+merge/76156
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-17571-skh.
=== modified file 'survey/survey.py'
--- survey/survey.py	2011-01-18 11:54:45 +0000
+++ survey/survey.py	2011-09-20 06:27:29 +0000
@@ -180,9 +180,7 @@
         if context is None:
             context = {}
         data = super(survey_page, self).default_get(cr, uid, fields, context)
-        if context.get('line_order',False):
-            if len(context['line_order'][-1]) > 2 and type(context['line_order'][-1][2]) == type({}) and context['line_order'][-1][2].has_key('sequence'):
-                data['sequence'] = context['line_order'][-1][2]['sequence'] + 1
+        self.pool.get('survey.question').data_get(cr,uid,data,context)
         if context.has_key('survey_id'):
             data['survey_id'] = context.get('survey_id', False)
         return data
@@ -502,15 +500,22 @@
             'search_view_id': search_id[0],
             'context': context
         }
+    def data_get(self, cr, uid, data, context):
+            if data and context:
+                if context.get('line_order', False):
+                      lines =  context.get('line_order')
+                      seq = data.get('sequence', 0)
+                      for line in lines:
+                            seq = seq + 1
+                      data.update({'sequence': seq})
+            return data
+
 
     def default_get(self, cr, uid, fields, context=None):
         if context is None:
             context = {}
         data = super(survey_question, self).default_get(cr, uid, fields, context)
-        if context.get('line_order',False):
-            if len(context['line_order'][-1]) > 2 and type(context['line_order'][-1][2]) == type({}) and context['line_order'][-1][2].has_key('sequence'):
-                data['sequence'] = context['line_order'][-1][2]['sequence'] + 1
-
+        self.data_get(cr,uid,data,context)
         if context.has_key('page_id'):
             data['page_id']= context.get('page_id', False)
         return data
@@ -603,9 +608,7 @@
         if context is None:
             context = {}
         data = super(survey_answer, self).default_get(cr, uid, fields, context)
-        if context.get('line_order', False):
-            if len(context['line_order'][-1]) > 2 and type(context['line_order'][-1][2]) == type({}) and context['line_order'][-1][2].has_key('sequence'):
-                data['sequence'] = context['line_order'][-1][2]['sequence'] + 1
+        self.pool.get('survey.question').data_get(cr,uid,data,context)
         return data
 
 survey_answer()

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to