2
votes

I have an application that has integration with Odoo database through Odoo API. My application has Mongodb database. Basically, we call Odoo API to get the employees from Odoo, add some fields to the employee object and store it in our monogodb database. My question is how to keep the syncing between our database and Odoo database if one of the two parties edit the employee details? Is cron job a good idea, so I can call the Odoo API every 10 sec or so and check if there are any changes and update my database?

4
Odoo usually uses PostgreSQL as its database engine and the later has a feature called Write Ahead Log, WAL for short. Maybe you can read it, filter the operations you're interested in and replicate them on the MongoDB database.Adan Cortes

4 Answers

0
votes

With custom module.

You can override official ORM methods off odoo and manage calls for mongodb

As well with RPC-Services you can update or create or delete from mongodb to odoo.

SnippetBucket.com done similar solution for GPS tracking system for food ordering system.

0
votes

There is another way without cron job you will do it with "create", "write" and "unlink" method overwrite in odoo and the same think you have to do in your application side when "create", "write" or "unlink" then call odoo api.

and i above case i think you have to pass one Flag when create a new record like this record is create in odoo application and this record from your application. so easy to identify. because recursively Creation we have to stop that's why this flag is passed.

Thanks

0
votes

You can use "Server action" and apply when the record is updated(write), created(create) or delete(unlink), you need only do a overload over theses functions adding the call to the server action.

enter image description here

enter image description here

-2
votes

You can overwrite odoo functions : create ("used when you create new record") , write ("when you update ") and unlink ("on deletion") as an example

 @api.model
    def create(self, values):
        """Override default Odoo create function and extend."""
        # Do your custom logic here