Attached Files | Issue33364_posterminal.diff [^] (715 bytes) 2016-06-27 12:54 [Show Content] [Hide Content]diff --git a/web/org.openbravo.retail.posterminal/js/model/order.js b/web/org.openbravo.retail.posterminal/js/model/order.js
--- a/web/org.openbravo.retail.posterminal/js/model/order.js
+++ b/web/org.openbravo.retail.posterminal/js/model/order.js
@@ -1465,7 +1465,7 @@
}
});
}
- if (((options && options.line) ? options.line.get('qty') + qty : qty) < 0 && p.get('productType') === 'S') {
+ if (((options && options.line) ? options.line.get('qty') + qty : qty) < 0 && p.get('productType') === 'S' && !p.get('ignoreReturnApproval')) {
OB.UTIL.showLoading(false);
OB.UTIL.Approval.requestApproval(
OB.MobileApp.view.$.containerWindow.getRoot().model, [{
Issue33364_returns.diff [^] (10,481 bytes) 2016-06-27 12:54 [Show Content] [Hide Content]diff --git a/src-db/database/sourcedata/AD_MESSAGE.xml b/src-db/database/sourcedata/AD_MESSAGE.xml
--- a/src-db/database/sourcedata/AD_MESSAGE.xml
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml
@@ -90,24 +90,12 @@
<!--AD718FC097D64644981C0DF27CDC7C87--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
<!--AD718FC097D64644981C0DF27CDC7C87--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
<!--AD718FC097D64644981C0DF27CDC7C87--> <VALUE><![CDATA[OBRETUR_returnService_OutOfDate_warning]]></VALUE>
-<!--AD718FC097D64644981C0DF27CDC7C87--> <MSGTEXT><![CDATA[The overdue days to return of the following services has expired:%0]]></MSGTEXT>
+<!--AD718FC097D64644981C0DF27CDC7C87--> <MSGTEXT><![CDATA[The overdue days to return the following services have expired:%0]]></MSGTEXT>
<!--AD718FC097D64644981C0DF27CDC7C87--> <MSGTYPE><![CDATA[I]]></MSGTYPE>
<!--AD718FC097D64644981C0DF27CDC7C87--> <AD_MODULE_ID><![CDATA[540C0D82BFD74311A4912E29289B73CC]]></AD_MODULE_ID>
<!--AD718FC097D64644981C0DF27CDC7C87--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
<!--AD718FC097D64644981C0DF27CDC7C87--></AD_MESSAGE>
-<!--B50F397311F0414C91C5436D9D68B9CB--><AD_MESSAGE>
-<!--B50F397311F0414C91C5436D9D68B9CB--> <AD_MESSAGE_ID><![CDATA[B50F397311F0414C91C5436D9D68B9CB]]></AD_MESSAGE_ID>
-<!--B50F397311F0414C91C5436D9D68B9CB--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--B50F397311F0414C91C5436D9D68B9CB--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--B50F397311F0414C91C5436D9D68B9CB--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--B50F397311F0414C91C5436D9D68B9CB--> <VALUE><![CDATA[OBRETUR_approval.returnService_OutOfDate]]></VALUE>
-<!--B50F397311F0414C91C5436D9D68B9CB--> <MSGTEXT><![CDATA[The overdue days to return of the following services has expired:%0<br>A supervisor needs to approve the return]]></MSGTEXT>
-<!--B50F397311F0414C91C5436D9D68B9CB--> <MSGTYPE><![CDATA[I]]></MSGTYPE>
-<!--B50F397311F0414C91C5436D9D68B9CB--> <AD_MODULE_ID><![CDATA[540C0D82BFD74311A4912E29289B73CC]]></AD_MODULE_ID>
-<!--B50F397311F0414C91C5436D9D68B9CB--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
-<!--B50F397311F0414C91C5436D9D68B9CB--></AD_MESSAGE>
-
<!--C4A9EC3ECD6C4E4586E438B4AD7AF2BC--><AD_MESSAGE>
<!--C4A9EC3ECD6C4E4586E438B4AD7AF2BC--> <AD_MESSAGE_ID><![CDATA[C4A9EC3ECD6C4E4586E438B4AD7AF2BC]]></AD_MESSAGE_ID>
<!--C4A9EC3ECD6C4E4586E438B4AD7AF2BC--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff --git a/src-db/database/sourcedata/AD_PREFERENCE.xml b/src-db/database/sourcedata/AD_PREFERENCE.xml
--- a/src-db/database/sourcedata/AD_PREFERENCE.xml
+++ b/src-db/database/sourcedata/AD_PREFERENCE.xml
@@ -11,4 +11,15 @@
<!--B80567E8E2C64CCDBA19484A346A820A--> <AD_MODULE_ID><![CDATA[540C0D82BFD74311A4912E29289B73CC]]></AD_MODULE_ID>
<!--B80567E8E2C64CCDBA19484A346A820A--></AD_PREFERENCE>
+<!--ECE9124D853743579062B93689020EA3--><AD_PREFERENCE>
+<!--ECE9124D853743579062B93689020EA3--> <AD_PREFERENCE_ID><![CDATA[ECE9124D853743579062B93689020EA3]]></AD_PREFERENCE_ID>
+<!--ECE9124D853743579062B93689020EA3--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ECE9124D853743579062B93689020EA3--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ECE9124D853743579062B93689020EA3--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ECE9124D853743579062B93689020EA3--> <VALUE><![CDATA[Y]]></VALUE>
+<!--ECE9124D853743579062B93689020EA3--> <PROPERTY><![CDATA[OBRETUR_approval.overdueService]]></PROPERTY>
+<!--ECE9124D853743579062B93689020EA3--> <ISPROPERTYLIST><![CDATA[Y]]></ISPROPERTYLIST>
+<!--ECE9124D853743579062B93689020EA3--> <AD_MODULE_ID><![CDATA[540C0D82BFD74311A4912E29289B73CC]]></AD_MODULE_ID>
+<!--ECE9124D853743579062B93689020EA3--></AD_PREFERENCE>
+
</data>
diff --git a/src-db/database/sourcedata/AD_REF_LIST.xml b/src-db/database/sourcedata/AD_REF_LIST.xml
--- a/src-db/database/sourcedata/AD_REF_LIST.xml
+++ b/src-db/database/sourcedata/AD_REF_LIST.xml
@@ -11,4 +11,15 @@
<!--5EE097DECB5A4D6995BD965B7331655B--> <AD_MODULE_ID><![CDATA[540C0D82BFD74311A4912E29289B73CC]]></AD_MODULE_ID>
<!--5EE097DECB5A4D6995BD965B7331655B--></AD_REF_LIST>
+<!--8DECBB2FD8114DE4BAF8B15028216095--><AD_REF_LIST>
+<!--8DECBB2FD8114DE4BAF8B15028216095--> <AD_REF_LIST_ID><![CDATA[8DECBB2FD8114DE4BAF8B15028216095]]></AD_REF_LIST_ID>
+<!--8DECBB2FD8114DE4BAF8B15028216095--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--8DECBB2FD8114DE4BAF8B15028216095--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--8DECBB2FD8114DE4BAF8B15028216095--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--8DECBB2FD8114DE4BAF8B15028216095--> <VALUE><![CDATA[OBRETUR_approval.overdueService]]></VALUE>
+<!--8DECBB2FD8114DE4BAF8B15028216095--> <NAME><![CDATA[Web POS Services Overdue Return Days Approval]]></NAME>
+<!--8DECBB2FD8114DE4BAF8B15028216095--> <AD_REFERENCE_ID><![CDATA[A26BA480E2014707B47257024C3CBFF7]]></AD_REFERENCE_ID>
+<!--8DECBB2FD8114DE4BAF8B15028216095--> <AD_MODULE_ID><![CDATA[540C0D82BFD74311A4912E29289B73CC]]></AD_MODULE_ID>
+<!--8DECBB2FD8114DE4BAF8B15028216095--></AD_REF_LIST>
+
</data>
diff --git a/web/org.openbravo.retail.returns/js/modalReturnLines.js b/web/org.openbravo.retail.returns/js/modalReturnLines.js
--- a/web/org.openbravo.retail.returns/js/modalReturnLines.js
+++ b/web/org.openbravo.retail.returns/js/modalReturnLines.js
@@ -447,7 +447,7 @@
});
},
finishOrder = _.after(me.args.args.order.receiptLines.length, finishOrderCreation),
- createOrderLines = function () {
+ createOrderLines = function (ignoreReturnApproval) {
_.each(me.args.args.order.receiptLines, function (line) {
if (!line.exceedsQuantity) {
var createLineFunction = function (prod) {
@@ -458,6 +458,7 @@
}
prod.set('ignorePromotions', true);
prod.set('standardPrice', line.priceIncludesTax ? line.unitPrice : line.baseNetUnitPrice);
+ prod.set('ignoreReturnApproval', ignoreReturnApproval);
order.addProductToOrder(prod, qty, null, {
'originalOrderLineId': line.lineId,
'originalDocumentNo': me.args.args.order.documentNo,
@@ -504,8 +505,11 @@
},
approvalNeeded = false,
currentDate = new Date(),
+ approvalList = [],
servicesToApprove = '',
- servicesToApproveArr = [];
+ servicesToApproveArr = [],
+ overdueServicesToApprove = '',
+ overdueServicesToApproveArr = [];
me.nameLocation = bpLoc.get('name');
bp.set('locationModel', bpLoc);
@@ -525,33 +529,42 @@
currentDate.setMilliseconds(0);
for (i = 0; i < me.args.args.order.receiptLines.length; i++) {
var line = me.args.args.order.receiptLines[i];
- if (!line.notReturnable) {
- if (line.productType === 'S' && (line.overdueReturnDays < 0 || ((currentDate.getTime() - line.overdueReturnDays * 86400000) > (new Date(me.args.args.order.orderDate)).getTime()))) {
- servicesToApprove += '<br>· ' + line.name;
- servicesToApproveArr.push(' * ' + line.name);
- if (!approvalNeeded) {
- approvalNeeded = true;
- }
+ if (line.productType === 'S' && !line.notReturnable) {
+ servicesToApprove += '<br>· ' + line.name;
+ servicesToApproveArr.push(' * ' + line.name)
+ approvalNeeded = true;
+ if (line.overdueReturnDays < 0 || ((currentDate.getTime() - line.overdueReturnDays * 86400000) > (new Date(me.args.args.order.orderDate)).getTime())) {
+ overdueServicesToApprove += '<br>· ' + line.name;
+ overdueServicesToApproveArr.push(' * ' + line.name);
}
- } else {
- OB.UTIL.showConfirmation.display(OB.I18N.getLabel('OBPOS_UnreturnableProduct'), OB.I18N.getLabel('OBPOS_UnreturnableProductMessage', [line.name]));
- return;
}
}
+
if (approvalNeeded) {
+ if (!OB.MobileApp.model.hasPermission('OBPOS_approval.returnService', true)) {
+ approvalList.push({
+ approval: 'OBPOS_approval.returnService',
+ message: 'OBPOS_approval.returnService',
+ params: [servicesToApprove]
+ });
+ }
+ if (!OB.MobileApp.model.hasPermission('OBRETUR_approval.overdueService', true) && overdueServicesToApprove.length > 0) {
+ approvalList.push({
+ approval: 'OBRETUR_approval.overdueService',
+ message: 'OBRETUR_returnService_OutOfDate_warning',
+ params: [overdueServicesToApprove]
+ })
+ }
+
OB.UTIL.showLoading(false);
OB.UTIL.Approval.requestApproval(
- OB.MobileApp.view.$.containerWindow.getRoot().model, [{
- approval: 'OBPOS_approval.returnService',
- message: 'OBRETUR_approval.returnService_OutOfDate',
- params: [servicesToApprove]
- }], function (approved, supervisor, approvalType) {
+ OB.MobileApp.view.$.containerWindow.getRoot().model, approvalList, function (approved, supervisor) {
if (approved) {
- if (supervisor.id === OB.POS.terminal.terminal.usermodel.id) {
- OB.UTIL.showConfirmation.display(OB.I18N.getLabel('OBMOBC_LblWarning'), OB.I18N.getLabel('OBRETUR_returnService_OutOfDate_warning', [servicesToApproveArr]));
+ if (supervisor.id === OB.POS.terminal.terminal.usermodel.id && overdueServicesToApprove.length > 0) {
+ OB.UTIL.showConfirmation.display(OB.I18N.getLabel('OBMOBC_LblWarning'), OB.I18N.getLabel('OBRETUR_returnService_OutOfDate_warning', [overdueServicesToApproveArr]));
}
OB.UTIL.showLoading(true);
- createOrderLines();
+ createOrderLines(true);
}
});
} else {
Issue33364_pimobile.diff [^] (3,218 bytes) 2016-06-27 12:55 [Show Content] [Hide Content]diff --git a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/services/ReturnServiceOverdueDays.java b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/services/ReturnServiceOverdueDays.java
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/services/ReturnServiceOverdueDays.java
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/services/ReturnServiceOverdueDays.java
@@ -59,7 +59,8 @@
verify(TestIdPack.LABEL_VERIFIEDRETURNS_TITLE, "Receipts");
write(TestIdPack.FIELD_SEARCH_RECEIPT, receiptNo);
tap(TestIdPack.BUTTON_VERIFIEDRETURNS_SEARCH);
- verify(TestIdPack.LABEL_VERIFIEDRETURNS_ROW1_TITLE, String.format("%s - %s", receiptNo, customer));
+ verify(TestIdPack.LABEL_VERIFIEDRETURNS_ROW1_TITLE,
+ String.format("%s - %s", receiptNo, customer));
tap(TestIdPack.BUTTON_VERIFIEDRETURNS_ROW1);
verify(TestIdPack.LABEL_POPUP_DOCUMENTNO, receiptNo);
verify(TestIdPack.LABEL_NOTRETURABLE_SERVICE, "Not returnable");
@@ -88,7 +89,8 @@
verify(TestIdPack.LABEL_VERIFIEDRETURNS_TITLE, "Receipts");
write(TestIdPack.FIELD_SEARCH_RECEIPT, receiptNo);
tap(TestIdPack.BUTTON_VERIFIEDRETURNS_SEARCH);
- verify(TestIdPack.LABEL_VERIFIEDRETURNS_ROW1_TITLE, String.format("%s - %s", receiptNo, customer));
+ verify(TestIdPack.LABEL_VERIFIEDRETURNS_ROW1_TITLE,
+ String.format("%s - %s", receiptNo, customer));
tap(TestIdPack.BUTTON_VERIFIEDRETURNS_ROW1);
verify(TestIdPack.LABEL_POPUP_DOCUMENTNO, receiptNo);
tap(TestIdPack.BUTTON_POPUP_CHECKALL);
@@ -131,7 +133,8 @@
verify(TestIdPack.LABEL_VERIFIEDRETURNS_TITLE, "Receipts");
write(TestIdPack.FIELD_SEARCH_RECEIPT, receiptNo);
tap(TestIdPack.BUTTON_VERIFIEDRETURNS_SEARCH);
- verify(TestIdPack.LABEL_VERIFIEDRETURNS_ROW1_TITLE, String.format("%s - %s", receiptNo, customer));
+ verify(TestIdPack.LABEL_VERIFIEDRETURNS_ROW1_TITLE,
+ String.format("%s - %s", receiptNo, customer));
tap(TestIdPack.BUTTON_VERIFIEDRETURNS_ROW1);
verify(TestIdPack.LABEL_POPUP_DOCUMENTNO, receiptNo);
tap(TestIdPack.BUTTON_POPUP_CHECKALL);
@@ -141,7 +144,7 @@
// Warning popup indicating the service is out of date
verify(TestIdPack.LABEL_POPUP_TITLE, "WARNING!");
verify(TestIdPack.LABEL_POPUP_CONFIRMATION_TITLE,
- "The overdue days to return of the following services has expired: * Immediate Transportation");
+ "The overdue days to return the following services have expired: * Immediate Transportation");
tap(TestIdPack.BUTTON_POPUP_CONFIRMATION_OK);
verify(TestIdPack.LABEL_TOTALTOPAY, "-52.00");
@@ -184,7 +187,8 @@
verify(TestIdPack.LABEL_VERIFIEDRETURNS_TITLE, "Receipts");
write(TestIdPack.FIELD_SEARCH_RECEIPT, receiptNo);
tap(TestIdPack.BUTTON_VERIFIEDRETURNS_SEARCH);
- verify(TestIdPack.LABEL_VERIFIEDRETURNS_ROW1_TITLE, String.format("%s - %s", receiptNo, customer));
+ verify(TestIdPack.LABEL_VERIFIEDRETURNS_ROW1_TITLE,
+ String.format("%s - %s", receiptNo, customer));
tap(TestIdPack.BUTTON_VERIFIEDRETURNS_ROW1);
verify(TestIdPack.LABEL_POPUP_DOCUMENTNO, receiptNo);
tap(TestIdPack.BUTTON_POPUP_CHECKALL);
|