Attached Files | pi-mobile.diff [^] (5,466 bytes) 2018-12-13 13:17 [Show Content] [Hide Content]diff --git a/src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java b/src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java
@@ -1906,6 +1906,10 @@
"confirmationPopup_btnOk", EnyoKind.BUTTON); //
public static TestIdConstructor LABEL_POPUP_CONFIRMATION_TITLE = new TestIdConstructor(
"bodyContent_control"); //
+ public static TestIdConstructor LABEL_POPUP_STOCK_CONFIRMATION_TITLE = new TestIdConstructor(
+ "bodyContent_bodymessage"); //
+ public static TestIdConstructor BUTTON_POPUP_STOCK_CANCEL = new TestIdConstructor(
+ "bodyButtons_btnAction1", EnyoKind.BUTTON); //
public static TestIdConstructor LABEL_POPUP_DINAMIC_CONFIRMATION_TITLE = new TestIdConstructor(
"dynamicConfirmationPopup_bodyContent_control"); //
public static TestIdConstructor LABEL_POPUP_DINAMIC_CONFIRMATION_TITLE2 = new TestIdConstructor(
@@ -1920,7 +1924,7 @@
"bodyButtons_modalDialogButton", EnyoKind.BUTTON); //
public static TestIdConstructor BUTTON_POPUP_MODALACTION_CANCEL = new TestIdConstructor(
"bodyButtons_modalDialogButton2", EnyoKind.BUTTON); //
-
+
// Payment Provider Popup
public static TestIdConstructor POPUP_MODALPAYMENT = new TestIdConstructor("modalpayment_control"); //
public static TestIdConstructor POPUP_MODALPAYMENT_TITLE = new TestIdConstructor(
diff --git a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/productlockeddiscontinued/VerifyProductDiscontinuedAssortWithoutStock.java b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/productlockeddiscontinued/VerifyProductDiscontinuedAssortWithoutStock.java
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/productlockeddiscontinued/VerifyProductDiscontinuedAssortWithoutStock.java
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/productlockeddiscontinued/VerifyProductDiscontinuedAssortWithoutStock.java
@@ -44,11 +44,11 @@
tap(TestIdPack.BUTTON_SEARCH_EXECUTE);
tap(TestIdPack.BUTTON_SEARCHPRODUCT_CARSEATS);
verify(
- TestIdPack.LABEL_POPUP_CONFIRMATION_TITLE,
+ TestIdPack.LABEL_POPUP_STOCK_CONFIRMATION_TITLE,
"The product 'Car Seats' is in status Ramp-Down. The available stock ("
+ binQty.intValueExact()
+ ") at Vall Blanca Store Warehouse is lower than the quantity (1) to sell. Do you want to continue with the action anyway?");
- tap(TestIdPack.BUTTON_POPUP_OK);
+ tap(TestIdPack.BUTTON_POPUP_STOCK_CANCEL);
tap(TestIdPack.BUTTON_DELETERECEIPT);
tap(TestIdPack.BUTTON_DELETERECEIPT_CONFIRM);
diff --git a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/productlockeddiscontinued/VerifyProductDiscontinuedWithPreference.java b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/productlockeddiscontinued/VerifyProductDiscontinuedWithPreference.java
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/productlockeddiscontinued/VerifyProductDiscontinuedWithPreference.java
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/productlockeddiscontinued/VerifyProductDiscontinuedWithPreference.java
@@ -56,11 +56,11 @@
tap(TestIdPack.BUTTON_POPUP_OPENTICKETS_ROW1);
tap(TestIdPack.BUTTON_POPUP_OPENTICKETS_DONE);
verify(
- TestIdPack.LABEL_POPUP_CONFIRMATION_TITLE,
+ TestIdPack.LABEL_POPUP_STOCK_CONFIRMATION_TITLE,
"The product 'Car Seats' is in status Ramp-Down. The available stock ("
+ binQty.intValueExact()
+ ") at Vall Blanca Store Warehouse is lower than the quantity (1) to sell. Do you want to continue with the action anyway?");
- tap(TestIdPack.BUTTON_POPUP_CANCEL);
+ tap(TestIdPack.BUTTON_POPUP_STOCK_CANCEL);
// tap(TestIdPack.BUTTON_PAY);
// isDisabled(TestIdPack.BUTTON_PAY, true);
diff --git a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/productlockeddiscontinued/VerifyProductDiscontinuedWithoutStock.java b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/productlockeddiscontinued/VerifyProductDiscontinuedWithoutStock.java
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/productlockeddiscontinued/VerifyProductDiscontinuedWithoutStock.java
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/productlockeddiscontinued/VerifyProductDiscontinuedWithoutStock.java
@@ -44,18 +44,13 @@
write(TestIdPack.FIELD_SEARCH_TEXT, "Car Seats");
tap(TestIdPack.BUTTON_SEARCH_EXECUTE);
tap(TestIdPack.BUTTON_SEARCHPRODUCT_CARSEATS);
- String stock;
- if (ConnectionHelper.isOracle()) {
- stock = "0";
- } else {
- stock = "0.0";
- }
+ String stock = ConnectionHelper.isOracle() ? "0" : "0.0";
verify(
- TestIdPack.LABEL_POPUP_CONFIRMATION_TITLE,
+ TestIdPack.LABEL_POPUP_STOCK_CONFIRMATION_TITLE,
"The product 'Car Seats' is in status Ramp-Down. The available stock ("
+ stock
+ ") at Vall Blanca Store Warehouse is lower than the quantity (1) to sell. Do you want to continue with the action anyway?");
- tap(TestIdPack.BUTTON_POPUP_OK);
+ tap(TestIdPack.BUTTON_POPUP_STOCK_CANCEL);
tap(TestIdPack.BUTTON_DELETERECEIPT);
tap(TestIdPack.BUTTON_DELETERECEIPT_CONFIRM);
posterminal.diff [^] (7,066 bytes) 2018-12-13 13:19 [Show Content] [Hide Content]diff --git a/src/org/openbravo/retail/posterminal/OBPOSComponentProvider.java b/src/org/openbravo/retail/posterminal/OBPOSComponentProvider.java
--- a/src/org/openbravo/retail/posterminal/OBPOSComponentProvider.java
+++ b/src/org/openbravo/retail/posterminal/OBPOSComponentProvider.java
@@ -235,6 +235,7 @@
"pointofsale/view/subwindows/customeraddress/editcreatecustomeraddress",
"pointofsale/view/subwindows/customeraddress/customeraddrdetailview",
// Point of sale modals
+ "pointofsale/view/modals/modalstockdiscontinued",
"pointofsale/view/modals/modalstockinstore",
"pointofsale/view/modals/modalstockinstoreclickable",
"pointofsale/view/modals/modalstockinotherstore",
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
@@ -2256,27 +2256,42 @@
callback(false);
}
} else {
- OB.UTIL.showConfirmation.display(
- OB.I18N.getLabel('OBPOS_NotEnoughStock'), OB.I18N.getLabel('OBPOS_DiscontinuedWithoutStock', [p.get('_identifier'), productStatus.name, warehouse.warehouseqty, warehouse.warehousename, allLinesQty]), [{
- label: OB.I18N.getLabel('OBMOBC_LblOk'),
- action: function () {
- if (callback) {
- callback(true);
- }
- }
- }, {
- label: OB.I18N.getLabel('OBMOBC_LblCancel'),
- action: function () {
- navigateToStockScreen(warehouse);
- if (callback) {
- callback(false);
- }
- }
- }], {
- onHideFunction: function () {
- navigateToStockScreen(warehouse);
- if (callback) {
- callback(false);
+ OB.UTIL.showLoading(false);
+ OB.MobileApp.view.$.containerWindow.getRoot().doShowPopup({
+ popup: 'OBPOSPointOfSale_UI_Modals_ModalStockDiscontinued',
+ args: {
+ header: OB.I18N.getLabel('OBPOS_NotEnoughStock'),
+ message: OB.I18N.getLabel('OBPOS_DiscontinuedWithoutStock', [p.get('_identifier'), productStatus.name, warehouse.warehouseqty, warehouse.warehousename, allLinesQty]),
+ product: p,
+ buttons: [{
+ label: OB.I18N.getLabel('OBMOBC_LblOk'),
+ action: function () {
+ if (callback) {
+ callback(true);
+ }
+ }
+ }, {
+ label: OB.I18N.getLabel('OBMOBC_LblCancel'),
+ action: function () {
+ navigateToStockScreen(warehouse);
+ if (callback) {
+ callback(false);
+ }
+ }
+ }],
+ options: {
+ onHideFunction: function () {
+ navigateToStockScreen(warehouse);
+ if (callback) {
+ callback(false);
+ }
+ }
+ },
+ acceptLine: function (accept, newAttrs) {
+ if (accept && newAttrs) {
+ attrs = Object.assign(attrs, newAttrs);
+ }
+ callback(accept);
}
}
});
diff --git a/web/org.openbravo.retail.posterminal/js/pointofsale/view/modals/modalstockdiscontinued.js b/web/org.openbravo.retail.posterminal/js/pointofsale/view/modals/modalstockdiscontinued.js
new file mode 100644
--- /dev/null
+++ b/web/org.openbravo.retail.posterminal/js/pointofsale/view/modals/modalstockdiscontinued.js
@@ -0,0 +1,87 @@
+/*
+ ************************************************************************************
+ * Copyright (C) 2018 Openbravo S.L.U.
+ * Licensed under the Openbravo Commercial License version 1.0
+ * You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
+ * or in the legal folder of this module distribution.
+ ************************************************************************************
+ */
+
+/*global OB, enyo, _ */
+
+(function () {
+
+ enyo.kind({
+ kind: 'OB.UI.ModalAction',
+ name: 'OB.OBPOSPointOfSale.UI.Modals.ModalStockDiscontinued',
+ header: '',
+ bodyContent: {
+ components: [{
+ name: 'bodymessage',
+ content: ''
+ }]
+ },
+ buttonPushed: false,
+ buttons: [],
+ bodyButtons: {},
+ executeOnHide: function () {
+ if (!this.buttonPushed && this.args.options && this.args.options.onHideFunction) {
+ this.args.options.onHideFunction(this);
+ }
+ return true;
+ },
+ executeOnShow: function () {
+ var me = this;
+ this.buttonPushed = false;
+ this.acceptLine = this.args.acceptLine;
+ this.product = this.args.product;
+ this.autoDismiss = !OB.UTIL.isNullOrUndefined(this.args.options) && !OB.UTIL.isNullOrUndefined(this.args.options.autoDismiss) ? this.args.options.autoDismiss : true;
+ if (this.args.options && this.args.options.hideCloseButton) {
+ this.$.headerCloseButton.hide();
+ } else {
+ this.$.headerCloseButton.show();
+ }
+ this.$.header.setContent(this.args.header);
+ this.$.bodyContent.$.bodymessage.setContent(this.args.message);
+ // Destroy previous buttons
+ _.each(this.$.bodyButtons.getComponents(), function (cmp) {
+ if (cmp.kind === 'OB.UI.ModalDialogButton') {
+ cmp.destroy();
+ }
+ });
+ var buttons = this.args.buttons.concat(this.buttons);
+ // Create buttons
+ _.each(buttons, function (btn, indx) {
+ this.$.bodyButtons.createComponent({
+ kind: 'OB.UI.ModalDialogButton',
+ name: 'btnAction' + indx,
+ content: btn.label,
+ isDefaultAction: btn.isDefaultAction,
+ action: btn.action,
+ displayLogic: btn.displayLogic,
+ tap: function () {
+ me.buttonPushed = true;
+ if (this.action) {
+ this.action(true);
+ }
+ this.doHideThisPopup();
+ }
+ });
+ }, this);
+ this.$.bodyButtons.render();
+ // Apply display logic
+ _.each(this.$.bodyButtons.getComponents(), function (cmp) {
+ if (cmp.displayLogic) {
+ cmp.displayLogic();
+ }
+ });
+ return true;
+ }
+ });
+
+ OB.UI.WindowView.registerPopup('OB.OBPOSPointOfSale.UI.PointOfSale', {
+ kind: 'OB.OBPOSPointOfSale.UI.Modals.ModalStockDiscontinued',
+ name: 'OBPOSPointOfSale_UI_Modals_ModalStockDiscontinued'
+ });
+
+}());
\ No newline at end of file
|