Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Calling Python code from application

By
Andrija Burlic
on 11/10/14, 4:40 AM 583 views

Hi, I'm doing nice with OpenERP, but some help is always appreciated :)
When I want to call some Python funstions within the application (not via code, I know that), what's the right syntax?


For example, if I want to manually set up some workflow, in segment Python Action i should write some Python code. This is easy with some simplier code lines, but I have troubles calling some other Python functions, like:

states=pool.get('request.state')

or 

all_groups=self.pool.get('res.groups')

 

see link: http://screencast.com/t/dY3Db0ppsf

 

Error I'm getting is "SyntaxError: invalid syntax".

Can someone give me a hint?

Thanks in advance!

actually i coulnt understand your requirement..?

Anand
on 11/10/14, 4:50 AM

I updated question, check link above.

Andrija Burlic
on 11/10/14, 5:32 AM
0

Bole

--Bole--
2385
| 5 4 6
Zagreb | Karlovac, Croatia
--Bole--

there is only 10 kind of people the ones that understand binary ... and others

Bole
On 11/10/14, 8:08 AM

Better way of using python actions is to call a method from the object.. 

Check account_invoice workflow, action open (validating the invoice triggers 4 methods)...
If you need to modify something .. you have 2 choices.. 
1. override existing method 
2. add new method to specific action...

You can also use python syntax ( check account_invoice action proforma )
where it youst writes new value for state 

if more help or explanation needed.. feel free to ask : )

may the source be with you!

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 11/10/14, 4:40 AM
Seen: 583 times
Last updated: 3/16/15, 8:10 AM