Steps To Reproduce | In backend, go to the preference window and configure the Web POS Synchronized Mode preference.
Login in web pos.
Perform a cashup keeping nothing.
Create a layaway with a single product (e.g. Avalanche Transceiver).
Click on the total amount button and then on Layaway to synchronize the layaway.
Go to the menu > Pay Open Tickets, select the newly created layaway and click on Done.
Pay the layaway completely.
Verify using the Cashup Partial menu entry that the values on the local tables are correct (total transactions should match the total drops and the expected amount).
Go to backend, POS Terminal window. Find the used terminal, and on the Cash Up History find the newest cashup.
Verify that the header of the cashup shows the correct net/gross sales amount.
Verify that the Payment Method Status Cashup table still shows 0 for every transaction.
Go back to web pos, clear the cache, and reload.
Verify the status of the cashup using the Cash Up Partial option and verify that the deposits and the expected amount are now 0. |
Attached Files | multiOrderSynched.diff [^] (8,271 bytes) 2017-03-23 10:41 [Show Content] [Hide Content]diff --git a/web/org.openbravo.retail.posterminal/js/data/dataordersave.js b/web/org.openbravo.retail.posterminal/js/data/dataordersave.js
--- a/web/org.openbravo.retail.posterminal/js/data/dataordersave.js
+++ b/web/org.openbravo.retail.posterminal/js/data/dataordersave.js
@@ -412,83 +412,85 @@
currentReceipt.set('json', JSON.stringify(currentReceipt.serializeToJSON()));
OB.trace('Saving receipt.');
+ OB.UTIL.cashUpReport(currentReceipt, function (cashUp) {
+ currentReceipt.set('cashUpReportInformation', JSON.parse(cashUp.models[0].get('objToSend')));
+ currentReceipt.set('json', JSON.stringify(currentReceipt.serializeToJSON()));
+ OB.Dal.save(currentReceipt, function () {
+ OB.Dal.get(OB.Model.Order, receiptId, function (receipt) {
- OB.Dal.save(currentReceipt, function () {
- OB.Dal.get(OB.Model.Order, receiptId, function (receipt) {
+ var successCallback = function () {
+ OB.trace('Sync process success.');
- var successCallback = function () {
- OB.trace('Sync process success.');
+ if (OB.MobileApp.model.hasPermission('OBMOBC_SynchronizedMode', true)) {
- if (OB.MobileApp.model.hasPermission('OBMOBC_SynchronizedMode', true)) {
+ OB.UTIL.calculateCurrentCash();
+ _.each(model.get('multiOrders').get('multiOrdersList').models, function (theReceipt) {
+ me.context.get('multiOrders').trigger('print', theReceipt, {
+ offline: true
+ });
+ me.context.get('multiOrders').trigger('integrityOk', theReceipt);
+ OB.MobileApp.model.updateDocumentSequenceWhenOrderSaved(theReceipt.get('documentnoSuffix'), theReceipt.get('quotationnoSuffix'), receipt.get('returnnoSuffix'));
- OB.UTIL.calculateCurrentCash();
- _.each(model.get('multiOrders').get('multiOrdersList').models, function (theReceipt) {
- me.context.get('multiOrders').trigger('print', theReceipt, {
- offline: true
+ me.context.get('orderList').current = theReceipt;
+ me.context.get('orderList').deleteCurrent();
});
- me.context.get('multiOrders').trigger('integrityOk', theReceipt);
- OB.MobileApp.model.updateDocumentSequenceWhenOrderSaved(theReceipt.get('documentnoSuffix'), theReceipt.get('quotationnoSuffix'), receipt.get('returnnoSuffix'));
- me.context.get('orderList').current = theReceipt;
- me.context.get('orderList').deleteCurrent();
- });
+ // OB.UTIL.cashUpReport(model.get('multiOrders').get('multiOrdersList').models);
+ //this logic executed when all orders are ready to be sent
+ me.context.get('leftColumnViewManager').setOrderMode();
+ }
- OB.UTIL.cashUpReport(model.get('multiOrders').get('multiOrdersList').models);
+ model.get('multiOrders').resetValues();
- //this logic executed when all orders are ready to be sent
- me.context.get('leftColumnViewManager').setOrderMode();
- }
+ OB.UTIL.showLoading(false);
+ if (me.hasInvLayaways) {
+ OB.UTIL.showWarning(OB.I18N.getLabel('OBPOS_noInvoiceIfLayaway'));
+ me.hasInvLayaways = false;
+ }
+ OB.UTIL.showSuccess(OB.I18N.getLabel('OBPOS_MsgAllReceiptSaved'));
+ OB.UTIL.SynchronizationHelper.finished(synchId, "multiOrdersClosed");
+ model.get('multiOrders').trigger('checkOpenDrawer');
+ };
- model.get('multiOrders').resetValues();
+ var errorCallback = function () {
+ OB.UTIL.showError(OB.I18N.getLabel('OBPOS_MsgAllReceiptNotSaved'));
+ OB.UTIL.SynchronizationHelper.finished(synchId, "multiOrdersClosed");
- OB.UTIL.showLoading(false);
- if (me.hasInvLayaways) {
- OB.UTIL.showWarning(OB.I18N.getLabel('OBPOS_noInvoiceIfLayaway'));
- me.hasInvLayaways = false;
- }
- OB.UTIL.showSuccess(OB.I18N.getLabel('OBPOS_MsgAllReceiptSaved'));
+
+ // recalculate after an error also
+ if (OB.MobileApp.model.hasPermission('OBMOBC_SynchronizedMode', true)) {
+ OB.UTIL.calculateCurrentCash();
+ }
+ };
+
+ if (!_.isUndefined(receipt.get('amountToLayaway')) && !_.isNull(receipt.get('amountToLayaway')) && receipt.get('generateInvoice')) {
+ me.hasInvLayaways = true;
+ }
+ if (!OB.MobileApp.model.hasPermission('OBMOBC_SynchronizedMode', true)) {
+ model.get('orderList').current = receipt;
+ model.get('orderList').deleteCurrent();
+ }
+ me.ordersToSend += 1;
+ if (model.get('multiOrders').get('multiOrdersList').length === me.ordersToSend) {
+ OB.trace('Execution Sync process.');
+
+ OB.MobileApp.model.runSyncProcess(successCallback, errorCallback);
+ me.ordersToSend = OB.DEC.Zero;
+ } else {
OB.UTIL.SynchronizationHelper.finished(synchId, "multiOrdersClosed");
- model.get('multiOrders').trigger('checkOpenDrawer');
- };
+ }
- var errorCallback = function () {
- OB.UTIL.showError(OB.I18N.getLabel('OBPOS_MsgAllReceiptNotSaved'));
- OB.UTIL.SynchronizationHelper.finished(synchId, "multiOrdersClosed");
+ if (callback instanceof Function) {
+ callback();
+ }
+ }, null);
+ }, function () {
+ // We do nothing:
+ // we don't need to alert the user, as the order is still present in the database, so it will be resent as soon as the user logs in again
+ OB.UTIL.SynchronizationHelper.finished(synchId, "multiOrdersClosed");
+ });
+ });
-
- // recalculate after an error also
- if (OB.MobileApp.model.hasPermission('OBMOBC_SynchronizedMode', true)) {
- OB.UTIL.calculateCurrentCash();
- }
- model.get('multiOrders').resetValues();
- };
-
- if (!_.isUndefined(receipt.get('amountToLayaway')) && !_.isNull(receipt.get('amountToLayaway')) && receipt.get('generateInvoice')) {
- me.hasInvLayaways = true;
- }
- if (!OB.MobileApp.model.hasPermission('OBMOBC_SynchronizedMode', true)) {
- model.get('orderList').current = receipt;
- model.get('orderList').deleteCurrent();
- }
- me.ordersToSend += 1;
- if (model.get('multiOrders').get('multiOrdersList').length === me.ordersToSend) {
- OB.trace('Execution Sync process.');
-
- OB.MobileApp.model.runSyncProcess(successCallback, errorCallback);
- me.ordersToSend = OB.DEC.Zero;
- } else {
- OB.UTIL.SynchronizationHelper.finished(synchId, "multiOrdersClosed");
- }
-
- if (callback instanceof Function) {
- callback();
- }
- }, null);
- }, function () {
- // We do nothing:
- // we don't need to alert the user, as the order is still present in the database, so it will be resent as soon as the user logs in again
- OB.UTIL.SynchronizationHelper.finished(synchId, "multiOrdersClosed");
- });
});
};
|