Skip to Content
Menú
This question has been flagged
2 Respostes
3342 Vistes

Hello !


I'm new with Oddo 10. I'm trying to do some integration with another ERP and I want to send newly created sales orders to a message queue.


I want to do this through a server action with pyhton code but it seems you cannot use "import" in this code to add external libraries.


How would I do that ! Do I have to create a new odoo module ? If so, how do I refer to it from my python code inside the server action ?


Thanks !


Hugues

Avatar
Descartar

Why don't you use an automated scheduler if you'd like to do this every x time? If you wish to do it on save or create you could do it in the create or write function and call your external service there. Any specific requirement that made you choose for a server action to do this?

Autor Best Answer

Thanks,


Since we are newbies, we did not have a complete understanding of where custom code sould be.

We ended up creating a new model that inherits the Sales Order class and added a method to send the record to the RabbitMQ queue. This model is used in On Create action. Works great ! 

Avatar
Descartar

on create and write to update other part too