Openbravo Issue Tracking System - Retail Modules
View Issue Details
0035890Retail ModulesSessionspublic2017-03-15 10:282017-06-19 12:55
0035890: It's possible to execute in parallel the creation of two cashup objects in database
In sessions module, it's possible to execute in parallel the creation of two cashups with the same id in database.

This two cashups are created one from the openTill object (not a synchronization model) and other from the difference transaction when the store is open (cashmgmt is a synchronization model).
The issue is reproducible in the integration:

Errors in the OBPOS_Errors table while importing POS data: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
TYPE --> FIN_Finacc_Transaction
java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (TRY_RET_MODULES_ORACLE_SUITE2.OBPOS_APPCASH_PK) violated
Patch attached
No tags attached.
blocks defect 0035521 closed jorge-garcia It's possible to execute in parallel the creation of two cashup objects in database 
Issue History
2017-05-02 11:45jorge-garciaTypedefect => backport
2017-05-02 11:45jorge-garciaTarget Version => RR17Q1.2
2017-06-13 16:56hgbotCheckin
2017-06-13 16:56hgbotNote Added: 0097366
2017-06-13 16:56hgbotStatusscheduled => resolved
2017-06-13 16:56hgbotResolutionopen => fixed
2017-06-13 16:56hgbotFixed in SCM revision [^] => [^]
2017-06-19 12:55marvintmReview Assigned To => marvintm
2017-06-19 12:55marvintmStatusresolved => closed
2017-06-19 12:55marvintmFixed in Version => RR17Q1.2

2017-06-13 16:56   
Repository: retail/backports/3.0RR17Q1.2/org.openbravo.retail.posterminal
Changeset: 8117e3de4560ac519e1cec010b29bc3e8350c217
Author: Jorge Garcia <jorge.garcia <at>>
Date: Tue May 02 08:58:57 2017 +0200
URL: [^]

Fixed issue 35890: It's possible to execute in parallel the creation of two
cashup objects in database

The user case here is to do an open till and create a transaction with
differences in the count cash tab.

Both messages send information regarding the status of the cashup, the
cashup report.

If the cashup sent doesn’t exists in the database, the cashup is
created in order to save it.

At this point, we have implement a solution for two cases:

If synchronize mode is NOT active:

* Those two messages could be executed in parallel because open till message
is not a synchronize model and it’s executed immediately the server gets the
message. In this case, to avoid error in the cashup primary key trying to create
two cashups with the same id, we persist in database the header of the cashup,
and, in case there is a second message with the same cashup id, it will detect
the cashup and won’t try to create it again.

If synchronize mode is active:

* Those messages will not be executed at the same time. Until the open till
response is coming back from the server, the execution in WebPOS is stopped.
Then the transaction of differences in the count cash will be sent to the server,
and the cashup will exists.

M src/org/openbravo/retail/posterminal/