Odoo-mobile / framework

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

[OdooAccountManager] Cannot retrieve current user on relogin #314

Open jtampinco opened 7 years ago

jtampinco commented 7 years ago

When running the cloned code I noticed that everytime I logout my account and login again, the core framework cannot seem to find the 'current' logged-in user.

I traced the code to bit of code in the OdooActivity, which I have not yet changed since the beginning of the project.

private void validateUserObject() {
        if (OdooAccountManager.anyActiveUser(this)) {
            OUser user = OUser.current(this);
            if (!OdooAccountManager.isValidUserObj(this, user)
                    && app.inNetwork()) {
                OdooUserObjectUpdater.showUpdater(this, new OdooUserObjectUpdater.OnUpdateFinish() {
                    @Override
                    public void userObjectUpdateFinished() {
                        startActivity(new Intent(OdooActivity.this, OdooLogin.class));
                        finish();
                    }

                    @Override
                    public void userObjectUpdateFail() {
                        Toast.makeText(OdooActivity.this, OResource.string(OdooActivity.this,
                                R.string.toast_something_gone_wrong), Toast.LENGTH_LONG).show();
                        finish();
                    }
                });
            }
        }
    }

If the app cannot get the current user, I seem to not also access the models created by the app and thus crash the app entirely.

Any help would be appreciated! I just need to be pointed out at the right direction...

naitikvithlani commented 6 years ago

Hello @jtampinco ,

I am using the same framework with following functionality of odoo completely.