Notes |
|
(0080639)
|
hgbot
|
2015-09-25 12:47
|
|
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 9c0f979ec5e016e06fedcd7113f0c4f6abd0b6b4
Author: Jorge Garcia <jorge.garcia <at> openbravo.com>
Date: Tue Sep 22 08:43:20 2015 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/9c0f979ec5e016e06fedcd7113f0c4f6abd0b6b4 [^]
Fixed issue 30778: Cash UP Partial crashes
The problem was that the cashup partial tries to start from the step 5
(step CashKeep) instead of the step 6 (step PostPrint&Close).
Some functionality has changed and the cashup partial doesn't show the real
info in the report and in the ticket.
---
M web/org.openbravo.retail.posterminal/js/closecash/model/cashup-model.js
---
|
|
|
|
This fix overwrites a long function in class CashupPartial called *getCountCashSummary()* This function is the same as the overwritten function on class Cashup with just few changes as it can be seen in the attached file cashup_vs_cashuppartial.diff. this function can be easily refactored reducing the number of lines and complexity of the fix significantly the following way:
Instead of overwriting *getCountCashSummary()*, create few functions to represent the differences in class Cashup and overwrite in class CashupPartial these functions. For example a new function *getTotalQtyToKeep()* can be created invoked from *getCountCashSummary()* the following way:
In class Cashup:
getTotalQtyToKeep: function () {
return _.reduce(this.get('paymentList').models, function (total, model) {
if (model.get('qtyToKeep')) {
var cQtyToKeep = OB.UTIL.currency.toDefaultCurrency(model.get('paymentMethod').currency, model.get('qtyToKeep'));
return OB.DEC.add(total, cQtyToKeep);
} else {
return total;
}
}, 0);
},
In class CashupPartial
getTotalQtyToKeep: function () {
return OB.DEC.Zero;
}, |
|
|
|
The refactor of the function makes all the sense, but we are very close to the freeze of the current release, so we will leave the current version for now, and we will do the refactor for 16Q1.
A related issue has been reported for the refactor:
https://issues.openbravo.com/view.php?id=30960 [^] |
|