It is currently Sun Feb 12, 2012 8:25 am

All times are UTC + 2 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Howto call/launch a function from an action ?
PostPosted: Mon Mar 08, 2010 10:06 am 
Offline

Joined: Tue Aug 14, 2007 4:08 pm
Posts: 360
Hello all,
I'm really a beginner in python programming and I'd like to launch a python function from an action. I need, from the partner tree, to select partners in the list then, with the action, call a function to modify each of them. I know howto open a form but doesn't know howto call a function directly.

Thanks for your help


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 09, 2010 6:38 pm 
Offline

Joined: Fri Nov 21, 2008 9:56 am
Posts: 3061
Location: Lotharingie
you can create the function def in the specified class (def) which does changes you want, this in the python file, and for the action in the view call the function with the on_change attribute :
example :
sale_view line 107 :
field name="partner_id" on_change="onchange_partner_id(partner_id)"
call function in sale.py line 311 :
def onchange_partner_id(self, cr, uid, ids, part): .....

a little description in french for object and view :
http://myopenerp.blogspot.com/2009/12/l ... tails.html


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 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