← Back to team overview

openerp-expert-framework team mailing list archive

Accepting (int, long) apart from list

 

Lately, there seem to have gone several commits into 5.0 branch in both server 
and addons repositories which ensure some write() and unlink() functions 
accept integers and longs instead of a list of integers or longs in the 'ids' 
parameter.

It seems to me we're moving to the wrong direction. Probably in some cases, 
the wrong parameters are being used to pass them to those functions and 
instead of fixing the calls we're changing function "definitions" slowly 
bringing current source tree to a mess (if it wasn't enough as of yet).

Is there someone really revising those commits as promised in partner and 
community days some months ago?


--- a/openobject-extra-addons-5.0/project_crm/project_crm.py
+++ b/openobject-extra-addons-5.0/project_crm/project_crm.py
@@ -43,11 +43,13 @@ class project_task(osv.osv):
         return True
     
     def write(self, cr, uid, ids, vals, context={}):
+        if isinstance(ids, (int, long)):
+            ids = [ids]
         res = super(project_task,self).write(cr, uid, ids, vals, context)
         date_deadline = vals.get('date_deadline', False)
         if date_deadline:
             for task in self.browse(cr, uid, ids, context):
-                if task.case_id:         
+                if task.case_id:   
                     cr.execute("update crm_case set date = '%s' where id = %d 
" %(date_deadline, task.case_id.id))          
         return res
        

-- 
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 

Follow ups