Open ERP Forum
   IndexIndex   SearchSearch     RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   RSSRSS   Mailing ListMailing List   Log inLog in 

Howto call/launch a function from an action ?
 
Post new topic   Reply to topic    Open Object Forum Index -> Objects and Python Topics
View previous topic :: View next topic  
Author Message
forstera



Joined: 14 Aug 2007
Posts: 345

PostPosted: Mon Mar 08, 2010 10:06 am    Post subject: Howto call/launch a function from an action ? Reply with quote

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
Back to top
View user's profile Send private message
GEM



Joined: 21 Nov 2008
Posts: 1679
Location: Lotharingie

PostPosted: Tue Mar 09, 2010 6:38 pm    Post subject: Reply with quote

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/les-objets-en-details.html
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Open Object Forum Index -> Objects and Python Topics All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
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
You cannot vote in polls in this forum