write concurrency

Asked by Alberto Garcia (Factor Libre) on 2010-05-07

I have a onchange function that always have wirte concurrency warning n gtk client and web client.

The module is:
    def onchange_hyip(self, cr, uid, ids, hyip_account_id):

     print "========ids"
     print ids
     for hyip in self.browse(cr, uid, ids):
   if hyip_account_id:
    hyip_obj = self.pool.get('gpthyip.hyip.account').browse(cr, uid, hyip_account_id)
    hyip_id = hyip_obj.hyips_id.id
    self.write(cr, uid, ids, {'hyip_id_origin' : hyip_id} )

thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo GTK Client (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
Parthiv Patel
Solved:
2010-05-08
Last query:
2010-05-08
Last reply:
2010-05-08

Hi,

Instead of writing to the object in on_change event, better to RETURN the
value of that field as a result.
Following is the code that can help you out.

def onchange_hyip(self, cr, uid, ids, hyip_account_id):

       print "========ids"
       print ids
       for hyip in self.browse(cr, uid, ids):
                       if hyip_account_id:
                               hyip_obj = self.pool.get('gpthyip.hyip.
>
> account').browse(cr, uid, hyip_account_id)
> hyip_id = hyip_obj.hyips_id.id
> return {'value':{'hyip_id_origin' : hyip_id}
> }
>

On Sat, May 8, 2010 at 4:02 AM, Alberto Garcia (ACESIL) <
<email address hidden>> wrote:

> New question #110108 on OpenObject GTK Client:
> https://answers.launchpad.net/openobject-client/+question/110108
>
> I have a onchange function that always have wirte concurrency warning n gtk
> client and web client.
>
> The module is:
> def onchange_hyip(self, cr, uid, ids, hyip_account_id):
>
> print "========ids"
> print ids
> for hyip in self.browse(cr, uid, ids):
> if hyip_account_id:
> hyip_obj =
> self.pool.get('gpthyip.hyip.account').browse(cr, uid, hyip_account_id)
> hyip_id = hyip_obj.hyips_id.id
> self.write(cr, uid, ids, {'hyip_id_origin' :
> hyip_id} )
>
> thanks.
>
> --
> You received this question notification because you are an answer
> contact for OpenObject GTK Client.
>

--
Thanks & Regards,
Parthiv Patel

Thanks Parthiv http://techreceptives.com, that solved my question.