I found a solution (not sure it's the right one) and give a patch for.
Thanks to have a look and give me some feed-back.
Regards,
Joël
Le 6 nov. 08 à 14:14, Amit Mendapara a écrit :
> I have fixed the problem in trunk as well as branch 4.2. Please
> confirm
> whether it has solved your problem or not.
>
> ** Changed in: openobject-client-web
> Assignee: (unassigned) => Amit Mendapara (mendapara-amit)
> Status: New => In Progress
>
> --
> Name_search based on context don't work in o2m
> https://bugs.launchpad.net/bugs/290274
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in OpenObject Web Client: In Progress
>
> Bug description:
> Name_search based on context don't work in o2m field.
>
> If you add context tag on a tree view in o2m filed, this context is
> not pass to the name_search function. This is bad, cause it' very
> useful. You can for exemple make a filter on "activity" based on
> selected "account" in the line...
>
> An exemple:
>
> Here the field view definition in the tree part of o2m:
>
> <field name="activity" context="account_id=account_id"/>
>
> Here the name search of activity object:
>
> def name_search(self, cr, uid, name, args=None, operator='ilike',
> context=None, limit=80):
> if not args:
> args=[]
> acc_ids=[]
> if context.get('account_id',False):
>
> account_id
> =
> self
> .pool
> .get
> ('account
> .analytic.account').browse(cr,uid,context.get('account_id',False))
> #take the account wich have activity_ids
>
> acc_who_matters
> =self._get_first_AA_wich_have_activity(cr,uid,account_id)
> if acc_who_matters:
> for i in acc_who_matters.activity_ids:
> acc_ids.append(i.id)
> if not context:
> context={}
> account = self.search(cr, uid, [('code', '=', name),
> ('id','in',acc_ids)]+args, limit=limit, context=context)
> if not account:
> account = self.search(cr, uid, [('name', 'ilike', '%%%s%%' %
> name),('id','in',acc_ids)]+args, limit=limit, context=context)
> if not account:
> account = self.search(cr, uid, [('id','in',acc_ids)]+args,
> limit=limit, context=context)
> return self.name_get(cr, uid, account, context=context)
--
Joël Grand-Guillaume
OpenERP Consultant
Business Solutions
Camptocamp SA
PSE A, CH-1015 Lausanne
www.camptocamp.com
Hi,
It's ok for the call wich pass right the context now, but we still
have a problem I described here:
https:/ /bugs.launchpad .net/openobject -client- web/+bug/ 296328
I found a solution (not sure it's the right one) and give a patch for.
Thanks to have a look and give me some feed-back.
Regards,
Joël
Le 6 nov. 08 à 14:14, Amit Mendapara a écrit :
> I have fixed the problem in trunk as well as branch 4.2. Please client- web /bugs.launchpad .net/bugs/ 290274 "account_ id=account_ id"/> get('account_ id',False) : account' ).browse( cr,uid, context. get('account_ id',False) ) get_first_ AA_wich_ have_activity( cr,uid, account_ id) matters. activity_ ids: append( i.id) in',acc_ ids)]+args, limit=limit, context=context) 'id','in' ,acc_ids) ]+args, limit=limit, context=context) 'in',acc_ ids)]+args,
> confirm
> whether it has solved your problem or not.
>
> ** Changed in: openobject-
> Assignee: (unassigned) => Amit Mendapara (mendapara-amit)
> Status: New => In Progress
>
> --
> Name_search based on context don't work in o2m
> https:/
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in OpenObject Web Client: In Progress
>
> Bug description:
> Name_search based on context don't work in o2m field.
>
> If you add context tag on a tree view in o2m filed, this context is
> not pass to the name_search function. This is bad, cause it' very
> useful. You can for exemple make a filter on "activity" based on
> selected "account" in the line...
>
> An exemple:
>
> Here the field view definition in the tree part of o2m:
>
> <field name="activity" context=
>
> Here the name search of activity object:
>
> def name_search(self, cr, uid, name, args=None, operator='ilike',
> context=None, limit=80):
> if not args:
> args=[]
> acc_ids=[]
> if context.
>
> account_id
> =
> self
> .pool
> .get
> ('account
> .analytic.
> #take the account wich have activity_ids
>
> acc_who_matters
> =self._
> if acc_who_matters:
> for i in acc_who_
> acc_ids.
> if not context:
> context={}
> account = self.search(cr, uid, [('code', '=', name),
> ('id','
> if not account:
> account = self.search(cr, uid, [('name', 'ilike', '%%%s%%' %
> name),(
> if not account:
> account = self.search(cr, uid, [('id',
> limit=limit, context=context)
> return self.name_get(cr, uid, account, context=context)
--
Joël Grand-Guillaume
OpenERP Consultant
Business Solutions
Camptocamp SA p.com
PSE A, CH-1015 Lausanne
www.camptocam
Phone: +41 21 619 10 28
Office: +41 21 619 10 10
Fax: +41 21 619 10 00
Email: <email address hidden>
P Please consider the environment before printing this email