Odoo Help

0

Call an Action Server from Pyhton code

By
Bouzid MEDJDOUB
on 4/23/17, 8:20 PM 402 views

Hi;

I have two models :

-calculation_function : inherit the "ir.actions.server" model

-indicator that have the calculation_function model as attribute 


i want call this server action (calculation_function ) from a method that i writen in the Indicator model, i tried to call the run method ( indicator.calculation_function .run()) but it doesn't work.



I want to run a server action form my 

0
Bouzid MEDJDOUB
On 4/24/17, 10:37 AM

when I try to return the calculation function it shows me this error :

TypeError: 'ir.actions.server' object is not callable

I use Odoo 10


0
IT Libertas
On 4/24/17, 5:21 AM

You do not need 'run' for this. In order a method is executed initiate it in your method. Since we are speaking about ir.actions.server, you may return it in your methods. Important:

* the decorator should be api@multi. api@one would be executed, but the window would not be shown up

* you can return a window action only from another action (e.g. button click). It is impossible to return a window from 'create', 'write', 'inverse', 'compute', etc using standard Odoo tools. Again the method would be executed, but no window would appear.

E.g.:

@api.multi
def your_method(self):
  self.ensure_one()
  return self.indicator.calculation_function()

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 4/23/17, 8:20 PM
Seen: 402 times
Last updated: 4/24/17, 10:37 AM