Attached Files | CashlogyPosterminalHook.diff [^] (4,483 bytes) 2019-08-12 12:56 [Show Content] [Hide Content]diff --git a/web/org.openbravo.retail.posterminal/js/closecash/view/tabcashpayments.js b/web/org.openbravo.retail.posterminal/js/closecash/view/tabcashpayments.js
--- a/web/org.openbravo.retail.posterminal/js/closecash/view/tabcashpayments.js
+++ b/web/org.openbravo.retail.posterminal/js/closecash/view/tabcashpayments.js
@@ -412,44 +412,16 @@
this.$.total.printAmount(this.payment.get('foreignExpected'));
- if (!this.payment.get('coinsCollection')) {
- this.$.paymentsList.hide();
- this.$.renderLoading.show();
-
- // First empty collection before loading.
- this.$.paymentsList.setCollection(new Backbone.Collection());
- this.payment.set('foreignCounted', 0);
- this.payment.set('counted', 0);
- this.payment.set('foreignDifference', OB.DEC.sub(0, this.payment.get('foreignExpected')));
- this.printTotals();
-
- this.setCoinsStatus(null);
+ OB.UTIL.HookManager.executeHooks('OBPOS_PreInitCashupHook', {
+ context: this
+ }, function (args) {
+ var me = args.context;
+ if (!me.payment.get('coinsCollection')) {
+ me.$.paymentsList.hide();
+ me.$.renderLoading.show();
- // Call to draw currencies.
- var currencyId = payment.get('paymentMethod').currency;
- var me = this;
- OB.Dal.find(OB.Model.CurrencyPanel, {
- currency: currencyId,
- _orderByClause: 'line'
- }, function (coins) {
- var coinCol = new Backbone.Collection();
-
- if (coins.length === 0 && payment.get('paymentMethod').currency === '102') {
- coins = OB.OBPOSCashUp.UI.RenderCashPaymentsLine.getLegacyCoins();
- }
-
- coins.each(function (coin) {
- var coinModel = new Backbone.Model();
- coinModel.set('numberOfCoins', 0);
- coinModel.set('totalAmount', 0);
- coinModel.set('coinValue', coin.get('amount'));
- coinModel.set('backcolor', coin.get('backcolor'));
- coinModel.set('bordercolor', coin.get('bordercolor'));
- coinCol.add(coinModel);
- });
-
- me.payment.set('coinsCollection', coinCol);
- me.$.paymentsList.setCollection(coinCol);
+ // First empty collection before loading.
+ me.$.paymentsList.setCollection(new Backbone.Collection());
me.payment.set('foreignCounted', 0);
me.payment.set('counted', 0);
me.payment.set('foreignDifference', OB.DEC.sub(0, me.payment.get('foreignExpected')));
@@ -457,17 +429,50 @@
me.setCoinsStatus(null);
- me.$.renderLoading.hide();
- me.$.paymentsList.show();
- });
- } else {
- this.$.paymentsList.setCollection(this.payment.get('coinsCollection'));
- this.printTotals();
+ // Call to draw currencies.
+ var currencyId = payment.get('paymentMethod').currency;
+ //var me = this;
+ OB.Dal.find(OB.Model.CurrencyPanel, {
+ currency: currencyId,
+ _orderByClause: 'line'
+ }, function (coins) {
+ var coinCol = new Backbone.Collection();
+
+ if (coins.length === 0 && payment.get('paymentMethod').currency === '102') {
+ coins = OB.OBPOSCashUp.UI.RenderCashPaymentsLine.getLegacyCoins();
+ }
- this.setCoinsStatus(null);
- }
+ coins.each(function (coin) {
+ var coinModel = new Backbone.Model();
+ coinModel.set('numberOfCoins', 0);
+ coinModel.set('totalAmount', 0);
+ coinModel.set('coinValue', coin.get('amount'));
+ coinModel.set('backcolor', coin.get('backcolor'));
+ coinModel.set('bordercolor', coin.get('bordercolor'));
+ coinCol.add(coinModel);
+ });
+ me.payment.set('coinsCollection', coinCol);
+ me.$.paymentsList.setCollection(coinCol);
+ me.payment.set('foreignCounted', 0);
+ me.payment.set('counted', 0);
+ me.payment.set('foreignDifference', OB.DEC.sub(0, me.payment.get('foreignExpected')));
+ me.printTotals();
+
+ me.setCoinsStatus(null);
+
+ me.$.renderLoading.hide();
+ me.$.paymentsList.show();
+ });
+ } else {
+ me.$.paymentsList.setCollection(me.payment.get('coinsCollection'));
+ me.printTotals();
+
+ me.setCoinsStatus(null);
+ }
+ });
},
+
displayStep: function (model) {
this.model = model;
var payment = model.get('paymentList').at(model.get('substep'));
|