diff --git a/web/org.openbravo.mobile.core/app/integration/remote-server/BackendServer.js b/web/org.openbravo.mobile.core/app/integration/remote-server/BackendServer.js
index 07b6e25b..56469014 100644
--- a/web/org.openbravo.mobile.core/app/integration/remote-server/BackendServer.js
+++ b/web/org.openbravo.mobile.core/app/integration/remote-server/BackendServer.js
@@ -76,6 +76,12 @@
       if (!context || !newContext) {
         return;
       }
+      const nextSimplifiedContext = {
+        userId: newContext.userId || newContext.user.id,
+        orgId: newContext.orgId || newContext.organization.id,
+        clientId: newContext.clientId || newContext.client.id,
+        roleId: newContext.roleId || newContext.role.id
+      };
       const currentContext = {
         userId: context.user.id,
         orgId: context.organization.id,
@@ -83,7 +89,7 @@
         roleId: context.role.id
       };
 
-      if (lodash.isEqual(currentContext, newContext)) {
+      if (lodash.isEqual(currentContext, nextSimplifiedContext)) {
         return;
       }
 
diff --git a/web/org.openbravo.mobile.core/app/model/application-state/State.js b/web/org.openbravo.mobile.core/app/model/application-state/State.js
index 1bb78bae..2994ba14 100644
--- a/web/org.openbravo.mobile.core/app/model/application-state/State.js
+++ b/web/org.openbravo.mobile.core/app/model/application-state/State.js
@@ -77,9 +77,18 @@
     actionPayload
   ) => {
     try {
+      const previousBackendMsgIds = getBackendMessageIds(
+        persistence.getState()
+      );
       persistence.dispatch(model, action, actionPayload, {
         globalState: persistence.getState()
       });
+      const updatedBackendMsgIds = getBackendMessageIds(persistence.getState());
+      if (anyNewBackendMessage(previousBackendMsgIds, updatedBackendMsgIds)) {
+        // if the action generated any backend message persist immediately to improve
+        // transactionality, see https://issues.openbravo.com/view.php?id=50925
+        await OB.App.State.persistence.stateStorePersistor.flush();
+      }
     } catch (error) {
       await executeAllActionPreparationRollbacks(
         OB.App.StateAPI[model][action],
@@ -91,6 +100,19 @@
     }
   };
 
+  function getBackendMessageIds(state) {
+    if (!state || !state.Messages) {
+      return [];
+    }
+    return state.Messages.filter(msg => msg.type === 'backend')
+      .filter(msg => msg.modelName !== 'OBMOBC_TerminalLog')
+      .map(msg => msg.id);
+  }
+
+  function anyNewBackendMessage(previous = [], current = []) {
+    return current.some(msg => !previous.includes(msg));
+  }
+
   const getStatePortion = (state, model) => {
     if (model !== 'Global') {
       return state[model];
