#🔒 Help Needed – Designing an Online Synchronization Strategy in Python (Push/Pull per Entity)

14 messages · Page 1 of 1 (latest)

thin falcon
#

Hi everyone!!

Im currently working on a heavily customized Odoo environment where I need to implement a custom online synchronization system for POS.

As you know Odoo already provides a default POS synchronization mechanism. However, due to the level of customization in this project, we can’t rely on the standard implementation and need to design the synchronization layer from scratch.

  • This involves syncing multiple models such as:

Employees
Users
Products
Stock / inventory quantities
Stock transfers
POS sessions
Cash register closings
Orders
Accounting-related data

The Challenge
Not all models follow the same synchronization logic:

Some require bidirectional sync (push & pull).
Some are pull-only (e.g., master data like products or users).
Some are push-only (e.g., POS orders created offline).
The system must support temporary offline usage and later reconciliation.
Conflict handling must be predictable and safe.

Since this is being built directly within Odoo, I’m trying to determine the best architectural approach using:

-Odoo ORM

  • write_date or version-based tracking (im currently working with write_date)
    -Custom change logs

I’m not asking anyone to build this for me hehe. I’m specifically looking for expert guidance on designing a clean and scalable sync architecture in Odoo, best practices for handling mixed push/pull rules per model, advice on conflict resolution strategies in this context, Feedback on whether my architectural approach makes sense (i can share a simplified version of the implementation for review)

The goal is to build this properly following Odoo’s architecture and Python best practices

If anyone has implemented a custom POS synchronization layer in Odoo, I would really appreciate your insights.

thank you very much in advance 🙏!!!

haughty apexBOT
#

@thin falcon

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

frail grove
#

What exactly are you asking help with?

#

your description seems pretty broad

thin falcon
# frail grove What exactly are you asking help with?

thanks for your interest and sorry

What I need help with is handling ID mapping at the Python/ORM level when pushing POS sessions from a local Odoo instance to a server...

Sessions are created offline and get a local ID. When pushed, the server creates a new session with a different ID. Orders are linked to the local session ID, so I need a clean way to reconcile that relationship during synchronization.

From a Python architecture perspective, this is basically an identity-mapping problem between two databases.

I could add something like a cloud_id field, but I’m trying to avoid modifying multiple models just for sync purposes

So my question is: what’s the cleanest way to handle this kind of distributed ID mapping in a Python-based sync layer without complicating the data model?

I’m looking for architectural guidance

frail grove
#

we had a similar problem with work and we would embed the "foreign" id in the model

thin falcon
frail grove
#

what you're saying is that adding a column would involve a table change that affects 3M rows?

#

in our case we had a JSON field storing unstructured data and we added it there

thin falcon
#

now i get it, what i was originally thinking was slightly different. instead of persisting the foreign id in the database, even inside a json field, i was considering handling the mapping only at the sync layer. basically include the remote id in the json payload during push, reconcile everything at that moment, and keep local ids purely local without storing the mapping long term ummm but using an existing json field for metadata actually sounds more cleaner

frail grove
#

in our design we stored the "remote" version of the data in the json field too, though this may not be suitable for your use case

#

I wasn't sure it was 100% appropriate for our case either but I didn't make that decision

haughty apexBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.