Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0038768
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Retail Modules] Web POSmajorrandom2018-06-15 13:442018-06-21 08:56
ReportermarvintmView Statuspublic 
Assigned Torqueralta 
PriorityhighResolutionfixedFixed in VersionRR18Q3
StatusclosedFix in branchFixed in SCM revisiona63bd8fd1219
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tomarvintm
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0038768: Invoice generation in cashup may fail randomly if multiple invoices are generated

DescriptionCurrently the cashup generates invoices with a temporary document number, and at the end of the process this temporary number is replaced by the final one. The reason it works in this way is to maximize performance by reducing contention, as generating the final document number requires acquiring a lock over a record in the AD_Sequence table, and it's in our best interest to try to minimise the duration of this lock.

However, there is a problem currently with the way this works. The cashup may generate more than one invoice (as multiple business partners may have generated orders, or different invoices for orders and returns may also be generated). A random document number is generated for each, but the random numbers generated for these document numbers are not very large, and there is a possibility of collision. If the same number is generated for two invoices in the same cashup, then the second one will fail because of the unique constraint in the document number column of the C_Invoice table.
Steps To ReproduceThe only way to reproduce this problem reliably is to change this line in OrderGroupingProcessor:


    final String strExecutionId = "WebPOS_CashUp_" + String.valueOf(rnd.nextInt(1000000));

so that it generates the same value and then create a cashup with more than one invoice.
Proposed SolutionThe temporary document number should contain a longer random component based on a UUID (to try to minimise the chances of locking), and also a fixed part (1, 2, 3, ...) to guarantee that even in the case of random collision, the invoices in the same cashup are correctly created.
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0105264)
hgbot (developer)
2018-06-19 17:48

Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: a63bd8fd12192f63525f89c75351ce7a8b9b19ea
Author: Rafael Queralta <rafaelcuba81 <at> gmail.com>
Date: Sun Jun 17 09:16:09 2018 -0400
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/a63bd8fd12192f63525f89c75351ce7a8b9b19ea [^]

Fixed issue 38768: Invoice generation in cashup may fail randomly if multiple
invoices are generated

- Added random UUID to avoid document number collision

---
M src/org/openbravo/retail/posterminal/OrderGroupingProcessor.java
---
(0105291)
hgbot (developer)
2018-06-21 08:55

Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 1efc59c9417f395a6217bae481cf3bfac41c448d
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Thu Jun 21 08:55:43 2018 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/1efc59c9417f395a6217bae481cf3bfac41c448d [^]

Related to issue 38768. Removed unnecessary lines.

---
M src/org/openbravo/retail/posterminal/OrderGroupingProcessor.java
---

- Issue History
Date Modified Username Field Change
2018-06-15 13:44 marvintm New Issue
2018-06-15 13:44 marvintm Assigned To => Retail
2018-06-15 13:44 marvintm Resolution time => 1530828000
2018-06-15 13:44 marvintm Triggers an Emergency Pack => No
2018-06-15 15:12 marvintm Proposed Solution updated
2018-06-15 20:39 rqueralta Assigned To Retail => rqueralta
2018-06-15 20:39 rqueralta Status new => scheduled
2018-06-19 17:48 hgbot Checkin
2018-06-19 17:48 hgbot Note Added: 0105264
2018-06-19 17:48 hgbot Status scheduled => resolved
2018-06-19 17:48 hgbot Resolution open => fixed
2018-06-19 17:48 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/a63bd8fd12192f63525f89c75351ce7a8b9b19ea [^]
2018-06-21 08:55 hgbot Checkin
2018-06-21 08:55 hgbot Note Added: 0105291
2018-06-21 08:56 marvintm Review Assigned To => marvintm
2018-06-21 08:56 marvintm Status resolved => closed
2018-06-21 08:56 marvintm Fixed in Version => RR18Q3


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker