← Back to team overview

openerp-expert-framework team mailing list archive

Re: Accepting (int, long) apart from list

 

A Dilluns, 9 d'agost de 2010, Albert Cervera i Areny va escriure:
> --- 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

By the way, this example is from 'extra-addons' but they were commited by 
people from openerp sa, and as stated, I also found that in ir_translation.py 
from server's repository.

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

References