Openbravo Issue Tracking System - Retail Modules
View Issue Details
0048939Retail ModulesWeb POSpublic2022-03-31 11:212022-04-17 21:15
AugustoMauch 
meriem_azaf 
normalmajorhave not tried
closedfixed 
5
 
RR22Q3 
No
0048939: Masterdata model that use extensions should take them into account when calculating the hash
Masterdata model definition in the backend includes the list of properties that should be taken into account to calculate a hash. That hash will then be used to determine when those properties have changed, in order to force a full refresh.

Currently there are two methods that return the list of fields to take into account for the hash:
- one that accepts the list of ModelExtension [1] and that returns the list of all properties included in those extensions
- another one that accepts an entity [2] and that returns all the properties of the given entity

The second one SHOULD NEVER be used in a master data model that uses ModelExtension, because if a new extension is included, or a new property in an existing extension is included, the new properties will not be included in the hash, and the full master data refresh that should take place will not happen.

[1] https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/blob/master/src/org/openbravo/mobile/core/master/MasterDataProcessHQLQuery.java#L102 [^]
[2] https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/blob/master/src/org/openbravo/mobile/core/master/MasterDataProcessHQLQuery.java#L118 [^]
One one hand, this is straightforward to see. Check what master data model are invoking this function and realize that all of them are using ModelExtension to build the HQL query.

To reproduce it:
- Start WebPOS and log in.
- Stop tomcat, add a any property to TaxCategoryProperties that adds a new property from a separate entity, i.e.:
    list.add(new HQLProperty("organization.name", "orgName"));
- Build the application
- Restart tomcat
- Log in again in WebPOS, no full refresh is done, this is wrong

[1] https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/blob/master/src/org/openbravo/mobile/core/master/MasterDataProcessHQLQuery.java#L118 [^]


No tags attached.
related to defect 0048884 closed meriem_azaf Full Refresh generated in deploy without changes or model insertion in webPOS 
Issue History
2022-03-31 11:21AugustoMauchNew Issue
2022-03-31 11:21AugustoMauchAssigned To => Triage Platform Base
2022-03-31 11:21AugustoMauchTriggers an Emergency Pack => No
2022-03-31 11:21AugustoMauchRelationship addedrelated to 0048884
2022-04-06 16:03AugustoMauchAssigned ToTriage Platform Base => meriem_azaf
2022-04-06 16:03AugustoMauchStatusnew => scheduled
2022-04-08 11:25hgbotNote Added: 0136436
2022-04-17 21:15hgbotNote Added: 0136539
2022-04-17 21:15hgbotResolutionopen => fixed
2022-04-17 21:15hgbotStatusscheduled => closed
2022-04-17 21:15hgbotFixed in Version => RR22Q3
2022-04-17 21:15hgbotNote Added: 0136540

Notes
(0136436)
hgbot   
2022-04-08 11:25   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/768 [^]
(0136539)
hgbot   
2022-04-17 21:15   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/768 [^]
(0136540)
hgbot   
2022-04-17 21:15   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal [^]
Changeset: a1d984ee41c366830023a52597ba0d6400f6ed5f
Author: Meriem Azaf <meriem.azaf@openbravo.com>
Date: 08-04-2022 11:24:51
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/commit/a1d984ee41c366830023a52597ba0d6400f6ed5f [^]

Fixes ISSUE-48939: Masterdata model that use extensions should take them into account when calculating the hash
Masterdata model definition in the backend includes the list of properties that should be taken into account to calculate a hash.
That hash will then be used to determine when those properties have changed, in order to force a full refresh.

Currently there are two methods that return the list of fields to take into account for the hash: getPropertiesFrom
- one that accepts the list of ModelExtension and that returns the list of all properties included in those extensions
- another one that accepts an entity and that returns all the properties of the given entity

The second one SHOULD NEVER be used in a master data model that uses ModelExtension, because if a new extension is included, or a new property in an existing extension is included, the new properties will not be included in the hash, and the full master data refresh that should take place will not happen.
To fix this, we search where the second method used and check if this module use the ModelExtension and after do the change.

---
M src/org/openbravo/retail/posterminal/master/Discount.java
M src/org/openbravo/retail/posterminal/master/ProductServiceLinked.java
M src/org/openbravo/retail/posterminal/master/TaxCategory.java
M src/org/openbravo/retail/posterminal/master/TaxCategoryBOM.java
---