Openbravo Issue Tracking System - Retail Modules
View Issue Details
0034382Retail ModulesStoreServerpublic2016-11-03 17:412016-12-27 10:37
plujan 
mtaal 
normalmajorhave not tried
closedfixed 
5
main 
 
AugustoMauch
No
0034382: [RR16Q4] Trying to install a module in the Central and the Stores throws a "duplicated key" error
When installing "Gift Cards" module using the backend's Module Management window, in the Central and the Stores at the same tiem, an error is shown:

In the Central:
Error: The outgoing batch Store2-37994 failed: ERROR: duplicate key value violates unique constraint "ad_window_access_un_key" Detail: Key (ad_role_id, ad_window_id)=(E717F902C44C455793463450495FF36B, 059C75147CC74DBCB85D04FEA1AEF24A) already exists.

The problem seems to be related to the automatic roles and the creation of the permissions for accessing the new window added by the module.
1. In a MultiServer layout of 1 Central and 2 stores, as System Admin in all the machines, go to Module Management window and install the Gift Cards module.
2. Start the three rebuild processes. You will get the error described above in the Central.
No tags attached.
related to defect 0036919 closed AugustoMauch Entries of ad_form_access related with the mobile warehouse form should be exported/synchronized 
Issue History
2016-11-03 17:41plujanNew Issue
2016-11-03 17:41plujanAssigned To => StoreServer
2016-11-03 17:41plujanTriggers an Emergency Pack => No
2016-11-21 11:54mtaalAssigned ToStoreServer => AugustoMauch
2016-11-22 17:42AugustoMauchReview Assigned To => mtaal
2016-11-22 17:43hgbotCheckin
2016-11-22 17:43hgbotNote Added: 0091753
2016-11-22 17:43hgbotStatusnew => resolved
2016-11-22 17:43hgbotResolutionopen => fixed
2016-11-22 17:43hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/9597d4aa995b9c50bba1f2c0bdeb5a731489cd65 [^]
2016-12-02 11:07mtaalNote Added: 0092017
2016-12-02 11:07mtaalStatusresolved => closed
2016-12-02 11:07mtaalFixed in Version => RR17Q1
2016-12-02 13:50mtaalAssigned ToAugustoMauch => mtaal
2016-12-02 13:50mtaalNote Added: 0092033
2016-12-02 13:50mtaalStatusclosed => new
2016-12-02 13:50mtaalResolutionfixed => open
2016-12-02 13:50mtaalFixed in VersionRR17Q1 =>
2016-12-02 14:52mtaalNote Added: 0092038
2016-12-02 20:32hgbotCheckin
2016-12-02 20:32hgbotNote Added: 0092053
2016-12-02 20:32hgbotStatusnew => resolved
2016-12-02 20:32hgbotResolutionopen => fixed
2016-12-02 20:32hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/9597d4aa995b9c50bba1f2c0bdeb5a731489cd65 [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/b430f51aa0858cacd68b9fed1e2be38aa4692b63 [^]
2016-12-03 01:01mtaalReview Assigned Tomtaal => AugustoMauch
2016-12-27 10:37AugustoMauchNote Added: 0093011
2016-12-27 10:37AugustoMauchStatusresolved => closed
2017-09-21 17:17AugustoMauchRelationship addedrelated to 0036919

Notes
(0091753)
hgbot   
2016-11-22 17:43   
Repository: erp/pmods/org.openbravo.retail.storeserver.synchronization
Changeset: 9597d4aa995b9c50bba1f2c0bdeb5a731489cd65
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Nov 22 17:40:54 2016 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/9597d4aa995b9c50bba1f2c0bdeb5a731489cd65 [^]

Fixes issue 34382: Tables used to give access to UI components are not synced

The following tables are no longer being synchronized:
-OBUIAPP_Process_Access
-AD_Tab_Access
-AD_Table_Access
-AD_Form_Access
-obuiapp_view_role_access
-AD_Window_Access
-AD_Process_Access
-AD_Field_Access
-OBUIAPP_NAVBAR_ROLE_ACCESS
-OBKMO_Widget_Class_Access

They have been removed because:
- The reference tables from the AD dataset. If new module is installed in the Central Server, some of those tables are automatically populated and if they were synchronized there would be referencial integrity errors in the targe database because the referenced record does not exist.
- Those who are populated automatically will be also created in the store server when the module is installed there
- The operation in the store server backend will be restricted by default.

---
M src-db/database/sourcedata/STRSYNC_SYNCHRONIZEDTABLE.xml
---
(0092017)
mtaal   
2016-12-02 11:07   
Reviewed
(0092033)
mtaal   
2016-12-02 13:50   
We should also remove these tables from the initial store server creation dataset
(0092038)
mtaal   
2016-12-02 14:52   
In addition, webpos uses a special form with id: B7B7675269CD4D44B628A2C6CF01244F. See here [1]

to control access to webpos the ad_form_access records with this form id should be replicated to the store server, also when doing initial store server creation.


[1]
https://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/file/0a11f64c44f9/src/org/openbravo/retail/posterminal/JSONProcessSimple.java#l12 [^]
(0092053)
hgbot   
2016-12-02 20:32   
Repository: erp/pmods/org.openbravo.retail.storeserver.synchronization
Changeset: b430f51aa0858cacd68b9fed1e2be38aa4692b63
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Fri Dec 02 20:31:50 2016 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/b430f51aa0858cacd68b9fed1e2be38aa4692b63 [^]

Fixes issue 34382: [RR16Q4] Trying to install a module in the Central and the Stores throws a "duplicated key" error
Remove tables (see below) from the store server creation dataset. Replicate/initial-create only the form_access of
the WebPOS form as this defines access to the webpos client.

Tables removed from the store server create dataset:
-OBUIAPP_Process_Access
-AD_Tab_Access
-AD_Table_Access
-AD_Form_Access
-obuiapp_view_role_access
-AD_Window_Access
-AD_Process_Access
-AD_Field_Access
-OBUIAPP_NAVBAR_ROLE_ACCESS
-OBKMO_Widget_Class_Access

AD_Form_Access is added back with a new whereclause

---
M src-db/database/sourcedata/AD_DATASET_TABLE.xml
M src-db/database/sourcedata/STRSYNC_CUSTOM_ROUTER.xml
M src-db/database/sourcedata/STRSYNC_SYNCHRONIZEDTABLE.xml
A src/org/openbravo/retail/storeserver/synchronization/router/FormAccessRouter.java
---
(0093011)
AugustoMauch   
2016-12-27 10:37   
Code reviewed and verified