Hi all,

Problem solved, but we still don't know why it occurred, so if anyone has any 
ideas please let me know.

Quick refresh:

TinyERP 4.1.1. Error occurred when trying to open up any category from the 
category tree, or clicking "other view".

The first step was to add some more descriptive debugging to netsvc.py:

(head to line 216):
                        # Extra debugging information, added on 23/07/2009
                        #logger.notifyChannel("web-services", LOG_ERROR, 
'Exception in call: ' + tb_s)

                        logger.notifyChannel("web-services", LOG_ERROR, 
'Exception in call: ' + tb_s + 'Parameters:\n    path: %s\n    method: %s\n    
params: %s\n' % (self.path, method, params))



This then gave us a little bit more information...



Fri, 24 Jul 2009 10:21:32 ERROR:web-services:Exception in call:

Traceback (most recent call last):

   File "/home/internethic/aus_erp_dev/bin/netsvc.py", line 208, in _dispatch

     r=m(*params)

   File "/home/internethic/aus_erp_dev/bin/service/web_services.py",

line 330, in execute

     res = service.execute(db, uid, object, method, *args)

   File "/home/internethic/aus_erp_dev/bin/osv/osv.py", line 104, in execute

     res = pool.execute_cr(cr, uid, obj, method, *args, **kw)

   File "/home/internethic/aus_erp_dev/bin/osv/osv.py", line 85, in execute_cr

     res = getattr(obj,method)(cr, uid, *args, **kw)

   File "/home/internethic/aus_erp_dev/bin/osv/orm.py", line 1524, in search

     (qu1,qu2,tables) = self._where_calc(cr, user, args, context)

   File "/home/internethic/aus_erp_dev/bin/osv/orm.py", line 1405, in 
_where_calc

     if not len(res_ids):

TypeError: len() of unsized object

Parameters:

     path: /xmlrpc/object

     method: execute

     params: ('mytinydb', 26, 'mypassword', 'product.product', 'search', 
[['categ_id', '=', 187], ('active', '=', 1)], 0.0, 80.0, 0,

{'active_ids': [187], 'active_id': 187})



============================

The interesting bit is at the end.



The issue seemed to be that the ERP client is passing an int, when the server 
is expecting a list. Why this would have changed recently, we don't know, 
because we don't perform any development work on Tiny - the only changes we 
make are data changes through day to day use (i.e. adding / editing products / 
sales etc).



Anyway, this part of the request parameters:



['categ_id', '=', 187]



seems to correspond to 'args[i]' in the code, so args[i][2] is an integer:



      if isinstance(args[i][2], basestring):

            res_ids = [x[0] for x in ...]

      else:

            res_ids = args[i][2]

      if not len(res_ids):    # ERROR

            return []



The fix is to insert an explicit check for res_ids being an integer, and then 
convert it into a list, like this:



         if isinstance(args[i][2], basestring):

                 res_ids = [x[0] for x in ...]

         else:

                 res_ids = args[i][2]

         if type(res_ids) == int:

                 res_ids = [res_ids]

         if not len(res_ids):

                 return []

===============================

Not out of the woods completely yet - if we open up the category tree, then 
double click a category it takes us to the list of products associated with 
that category.
If we want to add / edit categories, you have to select the category, then 
choose "switch view / list", then "switch view / list" again to get back the 
standard search / add / edit / delete list view of product categories. Not a 
show stopper because we can work with categories again, but obviously not 
great, because the work flow is borked.

So!

If anyone has any suggestions / comments on what we've found / done please tell 
me. Is there a better way to fix this? Any thoughts on why it might have 
happened? And if someone else is experiencing this same bug, hopefully this 
summary will make their life easier, compared to the resounding silence which 
met my initial request for help from this forum / list.

Regards,

Chris Herrmann
Far Edge Technology

http://www.faredge.com.au

_______________________________________________
Tinyerp-users mailing list
http://tiny.be/mailman2/listinfo/tinyerp-users

Reply via email to