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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0044421
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Retail Modules] Multi order paymentmajoralways2020-06-19 09:552020-06-25 15:51
ReporteraaroncaleroView Statuspublic 
Assigned Toranjith_qualiantech_com 
PriorityhighResolutionfixedFixed in VersionRR20Q3
StatusclosedFix in branchFixed in SCM revision2dc1f07ca39e
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

0044421: Multiorders prepayment calculation and OBPOS_hookPostMultiOrder hook are executed in parallel

DescriptionWhen navigating to the Pay Open Tickets window to pay several orders at the same time, there's a series of hooks and events to notify that the process has finished.
On the one hand there is the loadedMultiOrder event which, when triggered, it will launch the calculation of the prepayment amount.
On the other hand, there is the OBPOS_hookPostMultiOrder hook, which allows developers to add extra code after the Pay Open Tickets window has loaded (i.e. some custom code to automatically propose the use of credit notes).

These two points happen at the same time asynchronously, which can lead to the model in the hook to have incomplete information (i.e. missing totals)
Steps To ReproduceCheck the code here [1]
The hook is invoked right after triggering the event. If any code inside the event handling is asynchronous (i.e. the prepayments calculation, which happens at the end of that handler[2]) the hook will be invoked before the event handling has finished.


[1] https://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/file/tip/web/org.openbravo.retail.posterminal/js/pointofsale/view/pointofsale.js#l2073 [^]

[2]
https://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/file/tip/web/org.openbravo.retail.posterminal/js/components/order.js#l1800 [^]
Proposed SolutionThe handler for the loadedMultiOrder already accepts a callback as a parameter.
Wrap the call to OB.UTIL.HookManager.executeHooks in [1] in a function and add it as a callback of the loadedMultiOrder trigger.
This way we can ensure that the prepayment calculation (and any other async code in the handler) has finished before executing the hooks.
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0121007)
hgbot (developer)
2020-06-24 06:43

Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 2dc1f07ca39e0eb5e42cb2b6060ce2b3c587076a
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Wed Jun 24 10:12:38 2020 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/2dc1f07ca39e0eb5e42cb2b6060ce2b3c587076a [^]

Fixed issue-44421: Hook PostMultiOrder should be called in callback of loadedMultiOrder

---
M web/org.openbravo.retail.posterminal/js/pointofsale/view/pointofsale.js
---

- Issue History
Date Modified Username Field Change
2020-06-19 09:55 aaroncalero New Issue
2020-06-19 09:55 aaroncalero Assigned To => Retail
2020-06-19 09:55 aaroncalero Resolution time => 1594332000
2020-06-19 09:55 aaroncalero Triggers an Emergency Pack => No
2020-06-23 07:52 ranjith_qualiantech_com Assigned To Retail => ranjith_qualiantech_com
2020-06-24 06:43 hgbot Checkin
2020-06-24 06:43 hgbot Note Added: 0121007
2020-06-24 06:43 hgbot Status new => resolved
2020-06-24 06:43 hgbot Resolution open => fixed
2020-06-24 06:43 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/2dc1f07ca39e0eb5e42cb2b6060ce2b3c587076a [^]
2020-06-25 15:51 marvintm Review Assigned To => marvintm
2020-06-25 15:51 marvintm Status resolved => closed
2020-06-25 15:51 marvintm Fixed in Version => RR20Q3


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker