Openbravo Issue Tracking System - Retail Modules
View Issue Details
0038859Retail ModulesWeb POSpublic2018-06-28 18:452018-07-26 10:33
guilleaer 
ranjith_qualiantech_com 
normalmajorhave not tried
closedfixed 
5
 
RR18Q4 
marvintm
No
0038859: Calculations performed when cash management is done are not being managed in a transactional way
Code executed when "DONE" button is pressed in cash mangement window after add a drop or deposit should be transactional.

why?

There is information which is written in different tables and it must be consistent. Currently if the process fails or if it is interrupted we can have unpredictable discrepancies in tables afected by a cash management (cashup, cashmanagement and paymentmethodcashup)

The first function which should start the transaction is OB.UTIL.sumCashManagementToCashup which is called inside the function updateCashupInfo which is called recursively.
 -> Here paymentmethodcashup is readed, with those values and values coming from the action, new values are calculated and then updated and saved back in the DB. After that, cashup is updated through OB.UTIL.composeCashupInfo.
As you can see, above functions are being managed without transaction, so any error could lead into a situation like:
------> payment method cashup updated but not cashup
*note that OB.UTIL.composeCashupInfo is already prepared to work with tx but we are not using it

Next function to analyze is setCashupObjectInCashMgmt. This function is called recursively after updateCashupInfo. We need to analyze it from 2 perspectives.
a) For every iteration (except last one) a save is done in cashmanagment table. After this save, function is called again (recursively) until every event is processed.
----->>>>> This save should be also transactional
b) When all has been processed OB.UTIL.calculateCurrentCash function is executed. Again this function is already prepared to work with transactions but we are NOT using it. It can create a problem having cash management action without updating current cash
-->> The execution of OB.UTIL.calculateCurrentCash should be included in the same transaction used for all of the previous actions explained in this issue.


Then, synchronization can start. Here a different transaction starts already managed by synchronization engine so here there is nothing to do.
N/A
Use a transactianal approach for the process explained above
No tags attached.
Issue History
2018-06-28 18:45guilleaerNew Issue
2018-06-28 18:45guilleaerAssigned To => Retail
2018-06-28 18:45guilleaerResolution time => 1531951200
2018-06-28 18:45guilleaerTriggers an Emergency Pack => No
2018-06-28 23:52egoitzIssue Monitored: egoitz
2018-07-05 14:05ranjith_qualiantech_comStatusnew => scheduled
2018-07-06 08:03ranjith_qualiantech_comAssigned ToRetail => ranjith_qualiantech_com
2018-07-12 10:54hgbotCheckin
2018-07-12 10:54hgbotNote Added: 0105710
2018-07-12 10:54hgbotStatusscheduled => resolved
2018-07-12 10:54hgbotResolutionopen => fixed
2018-07-12 10:54hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/d0c321969e06bffeb59b4a84be9201f30d7325ec [^]
2018-07-17 16:58guilleaerReview Assigned To => guilleaer
2018-07-17 16:58guilleaerStatusresolved => closed
2018-07-17 16:58guilleaerFixed in Version => RR18Q4
2018-07-19 08:31hgbotCheckin
2018-07-19 08:31hgbotNote Added: 0105786
2018-07-19 08:31hgbotStatusclosed => resolved
2018-07-19 08:31hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/d0c321969e06bffeb59b4a84be9201f30d7325ec [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/1ad43c7c4a84b337cd8e23a082b41feb17ed7d15 [^]
2018-07-20 08:17ranjith_qualiantech_comNote Deleted: 0105786
2018-07-26 10:33marvintmReview Assigned Toguilleaer => marvintm
2018-07-26 10:33marvintmStatusresolved => closed

Notes
(0105710)
hgbot   
2018-07-12 10:54   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: d0c321969e06bffeb59b4a84be9201f30d7325ec
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Thu Jul 12 14:24:36 2018 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/d0c321969e06bffeb59b4a84be9201f30d7325ec [^]

Fixed issue 38859 : Added transaction for cash management dal operations

* Transaction is added while doing DONE operation in Cash management

---
M web/org.openbravo.retail.posterminal/js/cashmgmt/model/cashmgmt-model.js
M web/org.openbravo.retail.posterminal/js/utils/cashUpReportUtils.js
---