This forum is now just an archive. Use the new Q&A website
It is currently Fri Apr 25, 2014 1:51 am

All times are UTC + 2 hours




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: on_change executing at view init ??
PostPosted: Thu Nov 10, 2011 5:18 pm 
Offline

Joined: Thu Apr 21, 2011 10:30 am
Posts: 67
Location: Paris
Hi folks,

This is a weird behavior I just encountered with on_change:

I have a custom module with several on_change attributes set on multiple fields.
Whenever a new form loads to create a new record (doesn't happen while *editing* an existing record) the on_change hooked to BOOLEAN fields execute at view init time !!!

Why would that be ? There is nothing too fancy in my view.. appart from attrs, domains and on_change
I would like those on_change to execute only when the boolean value actually does change. I tried disabling the _defaults on those fields as well: same thing..

Anyone met the same behavior and solved it ?

_________________
OpenERP 6.0.4


Top
 Profile  
 
 Post subject: Re: on_change executing at view init ??
PostPosted: Thu Nov 10, 2011 6:07 pm 
Offline

Joined: Thu Apr 21, 2011 10:30 am
Posts: 67
Location: Paris
not only happens to boolean fields but other types too, like datetime etc..

_________________
OpenERP 6.0.4


Top
 Profile  
 
 Post subject: Re: on_change executing at view init ??
PostPosted: Tue Dec 13, 2011 11:16 am 
Offline

Joined: Thu Mar 31, 2011 8:45 am
Posts: 244
Location: Málaga, Spain
Recently i started to use web client, and i noticed on_change executing on loads, in gtk client on_change methods works as you want, but in web client, when you press the 'edit' button it will launch all on_change methods, this is so annoying when you have about 50 on_changes in a view like me, and some of them displays warnings, and it makes the client to work so slow.

_________________
Desarrollo Compuservice
Parque Tecnológico de Andalucía


Top
 Profile  
 
 Post subject: Re: on_change executing at view init ??
PostPosted: Mon Dec 26, 2011 11:50 pm 
Offline

Joined: Wed Nov 16, 2011 10:29 pm
Posts: 10
I find this a serious problem: i'm using on_change methods to calculate some default values (like default prices when choosing a product), but if the user changes and saves, on the next open, the on_change of the product_id is fired again, overwriting the user's input!

i'm trying to find some way to detect when it's being called up on window opening and return without doing anything, but no luck so far :x

_________________
--
Javier


Top
 Profile  
 
 Post subject: Re: on_change executing at view init ??
PostPosted: Wed Jan 04, 2012 5:13 pm 
Offline

Joined: Thu Apr 21, 2011 10:30 am
Posts: 67
Location: Paris
I am amazed that nobody suffered from this earlier since it breaks all the logic in the interface.

In a case I have a False value returned to some fields after on_change execution, therefore while entering a form in edit mode, some fields will go blank !

I'll look into bug reports and submit one if not already done.

server / web client v6.0.3

_________________
OpenERP 6.0.4


Top
 Profile  
 
 Post subject: Re: on_change executing at view init ??
PostPosted: Thu Jan 05, 2012 10:39 am 
Offline

Joined: Thu Apr 21, 2011 10:30 am
Posts: 67
Location: Paris
This bug relates to this problem:
https://bugs.launchpad.net/openobject-c ... bug/906003

_________________
OpenERP 6.0.4


Top
 Profile  
 
 Post subject: Re: on_change executing at view init ??
PostPosted: Thu Jun 14, 2012 12:02 am 
Offline

Joined: Fri Sep 24, 2010 12:45 am
Posts: 1
Any advantage on this topic, i have the same problem..... I think the on_change metod must not br triggered whe defaults function is called, i am used openerp6.1.1 web client.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC + 2 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:

Protected by Anti-Spam ACP