Openbravo Issue Tracking System - Retail Modules
View Issue Details
0043877Retail ModulesLoyalty Programs for Web POSpublic2020-04-27 12:062020-05-12 16:39
leyre-iriarte 
ranjith_qualiantech_com 
highmajoralways
closedfixed 
5
 
RR20Q3 
marvintm
2019-05-03
RR19Q3
https://code.openbravo.com/erp/pmods/org.openbravo.retail.loyalty.programs/rev/fbebc4634da4#l11.168 [^]
No
0043877: Extra fields are not supported in subcription creation
Before the commit mentioned it was possible to support extra fields added from external modules, but after changing the way of creating subscription it is not possible anymore.

This can potentially lead to synchronization errors (records in Errors While Importing POS Data window) if some SaveSubscriptionHooks depend on data from those extra fields.
Before 19Q3, the create subscription process worked as a simple JSONProcess. When clicking on the Save button of the create subscription window, the code would iterate all the fields of the window (both standard fields and those added from external modules[1]) and the send all the information to the SaveSubscription java process.

In 19Q3, the subscription creation process was transformed into a data synchronization process in order to support offline operations. With this change, the create subscription window was refactored, and the sendCreateSubscriptionRequest js function was renamed to saveNewSubscription and refactored [2].
While the popup itself still retains the ability to add new fields from external modules (the newAttributes array is still there, and components are created based on this array), these components are no longer taken into account by the saveNewSubscription function.


[1] https://code.openbravo.com/erp/pmods/org.openbravo.retail.loyalty.programs/file/58767b732e01/web/org.openbravo.retail.loyalty.programs/js/view/subscription-create-form.js#l240 [^]

[2] https://code.openbravo.com/erp/pmods/org.openbravo.retail.loyalty.programs/file/tip/web/org.openbravo.retail.loyalty.programs/js/view/subscription-create-form.js#l250 [^]
The saveNewSubscription function should take into account again all the fields part of the newAttributes array.
One possible point to add this would be when the initial subscription json is created[3], right before calling OBRLP.Util.getNewSubscriptionSyncModel().

[3] https://code.openbravo.com/erp/pmods/org.openbravo.retail.loyalty.programs/file/tip/web/org.openbravo.retail.loyalty.programs/js/view/subscription-create-form.js#l269 [^]
No tags attached.
Issue History
2020-04-27 12:06leyre-iriarteNew Issue
2020-04-27 12:06leyre-iriarteAssigned To => Retail
2020-04-27 12:06leyre-iriarteResolution time => 1589148000
2020-04-27 12:06leyre-iriarteRegression date => 2019-05-03
2020-04-27 12:06leyre-iriarteRegression introduced in release => RR19Q3
2020-04-27 12:06leyre-iriarteRegression introduced by commit => https://code.openbravo.com/erp/pmods/org.openbravo.retail.loyalty.programs/rev/fbebc4634da4#l11.168 [^]
2020-04-27 12:06leyre-iriarteTriggers an Emergency Pack => No
2020-04-27 12:22aaroncaleroDescription Updatedbug_revision_view_page.php?rev_id=20887#r20887
2020-04-27 12:22aaroncaleroSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=20889#r20889
2020-04-27 12:22aaroncaleroProposed Solution updated
2020-05-04 15:07ranjith_qualiantech_comAssigned ToRetail => ranjith_qualiantech_com
2020-05-04 15:07ranjith_qualiantech_comStatusnew => scheduled
2020-05-05 03:04hgbotCheckin
2020-05-05 03:04hgbotNote Added: 0119537
2020-05-06 04:51hgbotCheckin
2020-05-06 04:51hgbotNote Added: 0119593
2020-05-06 07:47ranjith_qualiantech_comStatusscheduled => resolved
2020-05-06 07:47ranjith_qualiantech_comResolutionopen => fixed
2020-05-06 18:26adrianromeroReview Assigned To => adrianromero
2020-05-06 18:26adrianromeroNote Added: 0119644
2020-05-06 18:26adrianromeroStatusresolved => closed
2020-05-06 18:26adrianromeroFixed in Version => RR20Q2
2020-05-12 13:47aaroncaleroNote Added: 0119780
2020-05-12 13:47aaroncaleroStatusclosed => new
2020-05-12 13:47aaroncaleroResolutionfixed => open
2020-05-12 13:47aaroncaleroFixed in VersionRR20Q2 =>
2020-05-12 16:39marvintmNote Added: 0119784
2020-05-12 16:39marvintmStatusnew => scheduled
2020-05-12 16:39marvintmStatusscheduled => resolved
2020-05-12 16:39marvintmFixed in Version => RR20Q3
2020-05-12 16:39marvintmResolutionopen => fixed
2020-05-12 16:39marvintmReview Assigned Toadrianromero => marvintm
2020-05-12 16:39marvintmStatusresolved => closed

Notes
(0119537)
hgbot   
2020-05-05 03:04   
Repository: erp/pmods/org.openbravo.retail.loyalty.programs
Changeset: 118b023e8d0608adacd820bd487bd90cad155498
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Tue May 05 06:34:21 2020 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.loyalty.programs/rev/118b023e8d0608adacd820bd487bd90cad155498 [^]

Related to issue 43877 : Subcription Program extra fields should be saved in model

* If fields are added to Subcription Program form through newAttributes,
  when saving the Subcription Program form, extra fields should be saved in model and in database

---
M web/org.openbravo.retail.loyalty.programs/js/utils/obrlputils.js
M web/org.openbravo.retail.loyalty.programs/js/view/subscription-create-form.js
---
(0119593)
hgbot   
2020-05-06 04:51   
Repository: erp/pmods/org.openbravo.retail.loyalty.programs
Changeset: 638be122e9fb6b7400d3107c3f11dd03a88a85c6
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Wed May 06 08:21:39 2020 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.loyalty.programs/rev/638be122e9fb6b7400d3107c3f11dd03a88a85c6 [^]

Related to issue 43877 : Subcription Program extra fields should be saved in model

* If memberId not exists, Subcription Program should be saved with empty memberId

---
M web/org.openbravo.retail.loyalty.programs/js/utils/obrlputils.js
---
(0119644)
adrianromero   
2020-05-06 18:26   
Verified
(0119780)
aaroncalero   
2020-05-12 13:47   
In our customer environment (upgrading from 19q1 to 20q1) this is still not working.
It seems that the model used to synchronize subscriptions (OB.Model.ChangedLoyaltySubscription) is a copy of the Subscription model: instead of being an (id, jsonobject) pair like most of the synchronization models (orders, changedbps, changedlocations, etc), it has the full definition of the columns that will be saved/synchronized.
Therefore, if we want to add new fields to the Create Subscription popup, we would need to add these fields as properties to 2 different models (the normal subscription and the changed subscription; while in 19q1 it was enough to just create the new field as part of the popup).

Should we assume that it's now required to define the new fields as model attributes? Is this the way of working with this popup now? Or should we wait for a proper fix?
(0119784)
marvintm   
2020-05-12 16:39   
Discussed internally. We are in the process of refactoring all sync models so that they work like Aarón suggests, as part of the migration to IndexedDB.Although this will still take a couple of weeks, we don't think refactoring the current model with the old implementation would make sense.

In the meantime, as explained, the model can be extended by adding the specific properties to the model definition.