Community: CMS / eCommerce Experts mailing list archives


Can I send a json request from a server action using python?

- 11/27/14 14:27:19

I'm new to odoo and openerp, and not quite grokking what is possible
with python in server actions.

I need to send a json request to another server each time a stock.move
is created.

So, can I import Kenneth Reitz' requests lib and maybe psycopg2 in
case I need to query for anything, and then send the request from
there, or am I limited to using just libraries which are already
present in the context of the server action?

One way to achieve this, that I'm quite confident would work, is to
have my addon inherit from the stock.move model and add a _create()
method and do whatever I need to inside it. I don't yet know enough to
see which solution will have undesirable consequences in the future.
Plus, given my lack of experience with odoo, it might just be better
to thoroughly learn the workings of server actions and automations now
instead of later.

Apologies if this isn't the right mailing list to ask this question,
it seemed the closest fit.