Odoo-mobile / framework

Odoo Mobile Framework
https://play.google.com/store/apps/dev?id=8607973775002477408
Other
327 stars 374 forks source link

Synchronization problem #395

Open belallioui opened 3 years ago

belallioui commented 3 years ago

Hello, I have a timing problem when I modify the stockPiking and its stock movements. the data entered in the stockPicking mobile application is sent. The stockMove data is saved at the base level of the mobile application. But after synchronization the stockMove of the tablet crashes with those of the server.

it's like syncronization is done in these directions: StockPicking app Mobile >> Server StockPicking Server >> Mobile App StockMove Server >> Mobile App this overwrites the new data from stockMove App Mobile with those from the server.

Code :

public class StockPickingService extends OSyncService implements ISyncFinishListener {

    public static final String TAG = StockPickingService.class.getSimpleName();
    private Context mContext;
    @Override
    public OSyncAdapter getSyncAdapter(OSyncService service, Context context) {
        mContext = context;
        return new OSyncAdapter(context, StockPicking.class, this, true);
    }

    @Override
    public void performDataSync(OSyncAdapter adapter, Bundle extras, OUser user) {
        if(adapter.getModel().getModelName().equals(StockPicking.MODEL_NAME)) {

            adapter.onSyncFinish(this);
        }
    }

    @Override
    public OSyncAdapter performNextSync(OUser user, SyncResult syncResult) {
        return new OSyncAdapter(mContext, StockMove.class, this, true);
    }
}

public class StockMoveService extends OSyncService {

    public static final String TAG = StockMoveService.class.getSimpleName();

    @Override
    public OSyncAdapter getSyncAdapter(OSyncService service, Context context) {
        return new OSyncAdapter(context, StockMove.class, this, true);
    }

    @Override
    public void performDataSync(OSyncAdapter adapter, Bundle extras, OUser user) {
        if(adapter.getModel().getModelName().equals(StockMove.MODEL_NAME)) {
            adapter.syncDataLimit(80);
        }
    }

}

Thanks for your help.