Openbravo Issue Tracking System - Retail Modules
View Issue Details
0039179Retail ModulesStoreServerpublic2018-08-23 12:592018-12-10 16:19
0039179: Changing the Role in a multiserver environment only changes the context in the Store
In a multiserver environment, when a login is done in webpos, sessions are created for both the store and the central servers (so it is possible to enter in both backends without relogging).
If a Role change is performed in WebPOS, this change is only reflected in the session of the Store Server.
In a multiserver environment:
Login in web pos with a user with several roles.
On the same browser session, open both the store server and the central server backends.
Verify that the user/profile information is the same in both backends.
In WebPOS, go to the menu > User > Profile, change the role and click on Apply.
After the pos has finished reloading, verify the profile information again in both backends.
> The backend of the Store Server will show the changed role
> The backend of the Central Server will show the original role, which is wrong.
No tags attached.
related to feature request 0039625pi closed mtaal The WebPOS broadcast service calls success always only on first server irrespective of its state 
Issue History
2018-08-23 12:59aaroncaleroNew Issue
2018-08-23 12:59aaroncaleroAssigned To => StoreServer
2018-08-23 12:59aaroncaleroTriggers an Emergency Pack => No
2018-09-11 12:10mtaalAssigned ToStoreServer => mtaal
2018-09-11 20:07mtaalNote Added: 0106693
2018-10-01 05:50hgbotCheckin
2018-10-01 05:50hgbotNote Added: 0107081
2018-10-01 05:50hgbotStatusnew => resolved
2018-10-01 05:50hgbotResolutionopen => fixed
2018-10-01 05:50hgbotFixed in SCM revision => [^]
2018-10-01 05:50mtaalReview Assigned To => AugustoMauch
2018-10-01 06:55mtaalNote Edited: 0107081bug_revision_view_page.php?bugnote_id=0107081#r17718
2018-10-16 16:12AugustoMauchNote Added: 0107339
2018-10-16 16:12AugustoMauchStatusresolved => closed
2018-10-24 09:27guillermogilNote Added: 0107540
2018-10-24 09:27guillermogilStatusclosed => new
2018-10-24 09:27guillermogilResolutionfixed => open
2018-11-14 11:07mtaalRelationship addedrelated to 0039625
2018-11-14 11:42mtaalNote Added: 0107903
2018-11-14 11:44mtaalNote Edited: 0107903bug_revision_view_page.php?bugnote_id=0107903#r17914
2018-12-01 19:52mtaalStatusnew => acknowledged
2018-12-01 19:54mtaalReview Assigned ToAugustoMauch => aaroncalero
2018-12-01 19:54mtaalStatusacknowledged => scheduled
2018-12-01 19:54mtaalNote Added: 0108206
2018-12-01 19:54mtaalStatusscheduled => resolved
2018-12-01 19:54mtaalResolutionopen => fixed
2018-12-09 22:07mtaalReview Assigned Toaaroncalero => AugustoMauch
2018-12-10 16:19AugustoMauchNote Added: 0108368
2018-12-10 16:19AugustoMauchStatusresolved => closed

2018-09-11 20:07   
Add code like below [1] in utils and [2] when reloading the page or after logging in.

OB.UTIL.callCentralServer = function (serviceUrl, data, success, error) {
  var servers = OB.RR.RequestRouter.servers,
      method = 'POST',
      server = _.filter(servers.models, function (srv) {
      return srv.get('mainServer');
  OB.UTIL.callServer(server.get('name'), serviceUrl, data, success, error);

OB.UTIL.loginOnCentralServer = function (success, error) {
  OB.UTIL.callCentralServer('', null, success, error);

2018-10-01 05:50   
(edited on: 2018-10-01 06:55)
Repository: erp/pmods/org.openbravo.retail.storeserver.synchronization
Changeset: 3935f5cec633a3df0725af34d643afcbdc289e62
Author: Martin Taal <martin.taal <at>>
Date: Mon Oct 01 05:50:05 2018 +0200
URL: [^]

Fixes issue 39179: Changing the Role in a multiserver environment only changes the context in the Store
Make the change role service broadcast so that all servers change the role

No code change was needed.

A src-db/database/sourcedata/OBMOBC_SERVICES.xml

2018-10-16 16:12   
Code reviewed and verified
2018-10-24 09:27   
Reopened due to failure in Single Server if there is a Mobile Server defined in Offline status.
It tries to do 2 calls, one fails and no callback gets executed.
2018-11-14 11:42   
(edited on: 2018-11-14 11:44)
Other reflection: there is also server to server communication. In this we use a cached session cookie [1] from the cs. So this is the session cookie of the session in the cs, this session cookie is cached in the ss session so it can be re-used when doing a ss-->cs request.

This cached session cookie is also (correctly) removed from the ss session at role change. So that a next call to the cs will do a relogin using the new role.

[1] [^]

2018-12-01 19:54   
I retested this and works:
- install multi-server
- run, login webpos
- check the backoffice and see the role (VallblancaUser for example), check in the same browser both central and store
- then in webpos change role (to VallblancaManual for example), check backoffice for both store and central

The question how the system operates when one of the servers is down is handled in the related issue. It is a broader question on how to handle success/failure in broadcast messages.
2018-12-10 16:19   
Code reviewed and verified