Attached Files | posterminal.diff [^] (24,111 bytes) 2015-05-20 16:44 [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
@@ -1909,6 +1909,18 @@
<!--543AF3AFD33D4CE2AD400E0E21B7DBAD--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
<!--543AF3AFD33D4CE2AD400E0E21B7DBAD--></AD_MESSAGE>
+<!--558E7273F63F41378C6EA1E5E6B5C46E--><AD_MESSAGE>
+<!--558E7273F63F41378C6EA1E5E6B5C46E--> <AD_MESSAGE_ID><![CDATA[558E7273F63F41378C6EA1E5E6B5C46E]]></AD_MESSAGE_ID>
+<!--558E7273F63F41378C6EA1E5E6B5C46E--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--558E7273F63F41378C6EA1E5E6B5C46E--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--558E7273F63F41378C6EA1E5E6B5C46E--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--558E7273F63F41378C6EA1E5E6B5C46E--> <VALUE><![CDATA[OBPOS_ErrRejectQuotation]]></VALUE>
+<!--558E7273F63F41378C6EA1E5E6B5C46E--> <MSGTEXT><![CDATA[It has failed to reject the quotation]]></MSGTEXT>
+<!--558E7273F63F41378C6EA1E5E6B5C46E--> <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--558E7273F63F41378C6EA1E5E6B5C46E--> <AD_MODULE_ID><![CDATA[FF808181326CC34901326D53DBCF0018]]></AD_MODULE_ID>
+<!--558E7273F63F41378C6EA1E5E6B5C46E--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--558E7273F63F41378C6EA1E5E6B5C46E--></AD_MESSAGE>
+
<!--5617CB1E0DBC4C2185427EB9B9606807--><AD_MESSAGE>
<!--5617CB1E0DBC4C2185427EB9B9606807--> <AD_MESSAGE_ID><![CDATA[5617CB1E0DBC4C2185427EB9B9606807]]></AD_MESSAGE_ID>
<!--5617CB1E0DBC4C2185427EB9B9606807--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -2005,6 +2017,18 @@
<!--58EE8DBE5A09427CAF0DCBA914E85B2B--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
<!--58EE8DBE5A09427CAF0DCBA914E85B2B--></AD_MESSAGE>
+<!--58F4564C016C443AB039D979DDECA3E6--><AD_MESSAGE>
+<!--58F4564C016C443AB039D979DDECA3E6--> <AD_MESSAGE_ID><![CDATA[58F4564C016C443AB039D979DDECA3E6]]></AD_MESSAGE_ID>
+<!--58F4564C016C443AB039D979DDECA3E6--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--58F4564C016C443AB039D979DDECA3E6--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--58F4564C016C443AB039D979DDECA3E6--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--58F4564C016C443AB039D979DDECA3E6--> <VALUE><![CDATA[OBPOS_SuccessRejectQuotation]]></VALUE>
+<!--58F4564C016C443AB039D979DDECA3E6--> <MSGTEXT><![CDATA[The quotation was sucessfully rejected]]></MSGTEXT>
+<!--58F4564C016C443AB039D979DDECA3E6--> <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--58F4564C016C443AB039D979DDECA3E6--> <AD_MODULE_ID><![CDATA[FF808181326CC34901326D53DBCF0018]]></AD_MODULE_ID>
+<!--58F4564C016C443AB039D979DDECA3E6--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--58F4564C016C443AB039D979DDECA3E6--></AD_MESSAGE>
+
<!--592E3BBC38424554B0ED804C4FF322D8--><AD_MESSAGE>
<!--592E3BBC38424554B0ED804C4FF322D8--> <AD_MESSAGE_ID><![CDATA[592E3BBC38424554B0ED804C4FF322D8]]></AD_MESSAGE_ID>
<!--592E3BBC38424554B0ED804C4FF322D8--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -2761,6 +2785,18 @@
<!--7D498E1BAC8847DD9CAD46F360D1F5F9--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
<!--7D498E1BAC8847DD9CAD46F360D1F5F9--></AD_MESSAGE>
+<!--7D9A6F0D4644491D8BFB05A9AEEDD566--><AD_MESSAGE>
+<!--7D9A6F0D4644491D8BFB05A9AEEDD566--> <AD_MESSAGE_ID><![CDATA[7D9A6F0D4644491D8BFB05A9AEEDD566]]></AD_MESSAGE_ID>
+<!--7D9A6F0D4644491D8BFB05A9AEEDD566--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--7D9A6F0D4644491D8BFB05A9AEEDD566--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--7D9A6F0D4644491D8BFB05A9AEEDD566--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--7D9A6F0D4644491D8BFB05A9AEEDD566--> <VALUE><![CDATA[OBPOS_lblRejectReason]]></VALUE>
+<!--7D9A6F0D4644491D8BFB05A9AEEDD566--> <MSGTEXT><![CDATA[Reject reason]]></MSGTEXT>
+<!--7D9A6F0D4644491D8BFB05A9AEEDD566--> <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--7D9A6F0D4644491D8BFB05A9AEEDD566--> <AD_MODULE_ID><![CDATA[FF808181326CC34901326D53DBCF0018]]></AD_MODULE_ID>
+<!--7D9A6F0D4644491D8BFB05A9AEEDD566--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--7D9A6F0D4644491D8BFB05A9AEEDD566--></AD_MESSAGE>
+
<!--7EC813AE2A094FE18CEA6ADD6071BA5C--><AD_MESSAGE>
<!--7EC813AE2A094FE18CEA6ADD6071BA5C--> <AD_MESSAGE_ID><![CDATA[7EC813AE2A094FE18CEA6ADD6071BA5C]]></AD_MESSAGE_ID>
<!--7EC813AE2A094FE18CEA6ADD6071BA5C--> <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
@@ -495,6 +495,17 @@
<!--BD5161AC42EF41B9BF4AC0D1FA8AB7B9--> <AD_MODULE_ID><![CDATA[FF808181326CC34901326D53DBCF0018]]></AD_MODULE_ID>
<!--BD5161AC42EF41B9BF4AC0D1FA8AB7B9--></AD_PREFERENCE>
+<!--C5D04174835145EB91684245BC21C49D--><AD_PREFERENCE>
+<!--C5D04174835145EB91684245BC21C49D--> <AD_PREFERENCE_ID><![CDATA[C5D04174835145EB91684245BC21C49D]]></AD_PREFERENCE_ID>
+<!--C5D04174835145EB91684245BC21C49D--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--C5D04174835145EB91684245BC21C49D--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--C5D04174835145EB91684245BC21C49D--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--C5D04174835145EB91684245BC21C49D--> <VALUE><![CDATA[Y]]></VALUE>
+<!--C5D04174835145EB91684245BC21C49D--> <PROPERTY><![CDATA[OBPOS_quotation.rejections]]></PROPERTY>
+<!--C5D04174835145EB91684245BC21C49D--> <ISPROPERTYLIST><![CDATA[Y]]></ISPROPERTYLIST>
+<!--C5D04174835145EB91684245BC21C49D--> <AD_MODULE_ID><![CDATA[FF808181326CC34901326D53DBCF0018]]></AD_MODULE_ID>
+<!--C5D04174835145EB91684245BC21C49D--></AD_PREFERENCE>
+
<!--C64A2C7B0BD340ABB5C04D606E212BA4--><AD_PREFERENCE>
<!--C64A2C7B0BD340ABB5C04D606E212BA4--> <AD_PREFERENCE_ID><![CDATA[C64A2C7B0BD340ABB5C04D606E212BA4]]></AD_PREFERENCE_ID>
<!--C64A2C7B0BD340ABB5C04D606E212BA4--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
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
@@ -402,6 +402,17 @@
<!--6A8FCA5AC0A94CFDBAE26E49BBDE2DD3--> <AD_MODULE_ID><![CDATA[FF808181326CC34901326D53DBCF0018]]></AD_MODULE_ID>
<!--6A8FCA5AC0A94CFDBAE26E49BBDE2DD3--></AD_REF_LIST>
+<!--6D8272633AB24DC29FB1CDC17F4CF7BF--><AD_REF_LIST>
+<!--6D8272633AB24DC29FB1CDC17F4CF7BF--> <AD_REF_LIST_ID><![CDATA[6D8272633AB24DC29FB1CDC17F4CF7BF]]></AD_REF_LIST_ID>
+<!--6D8272633AB24DC29FB1CDC17F4CF7BF--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--6D8272633AB24DC29FB1CDC17F4CF7BF--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--6D8272633AB24DC29FB1CDC17F4CF7BF--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--6D8272633AB24DC29FB1CDC17F4CF7BF--> <VALUE><![CDATA[OBPOS_quotation.rejections]]></VALUE>
+<!--6D8272633AB24DC29FB1CDC17F4CF7BF--> <NAME><![CDATA[Web POS Quotation rejections]]></NAME>
+<!--6D8272633AB24DC29FB1CDC17F4CF7BF--> <AD_REFERENCE_ID><![CDATA[A26BA480E2014707B47257024C3CBFF7]]></AD_REFERENCE_ID>
+<!--6D8272633AB24DC29FB1CDC17F4CF7BF--> <AD_MODULE_ID><![CDATA[FF808181326CC34901326D53DBCF0018]]></AD_MODULE_ID>
+<!--6D8272633AB24DC29FB1CDC17F4CF7BF--></AD_REF_LIST>
+
<!--6E2B450BFCC94F6E9228DFBD7A67F005--><AD_REF_LIST>
<!--6E2B450BFCC94F6E9228DFBD7A67F005--> <AD_REF_LIST_ID><![CDATA[6E2B450BFCC94F6E9228DFBD7A67F005]]></AD_REF_LIST_ID>
<!--6E2B450BFCC94F6E9228DFBD7A67F005--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff --git a/src-db/database/sourcedata/AD_TEXTINTERFACES.xml b/src-db/database/sourcedata/AD_TEXTINTERFACES.xml
--- a/src-db/database/sourcedata/AD_TEXTINTERFACES.xml
+++ b/src-db/database/sourcedata/AD_TEXTINTERFACES.xml
@@ -7,7 +7,7 @@
<!--2BBAB937E0764391807D9F26E393D70E--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
<!--2BBAB937E0764391807D9F26E393D70E--> <TEXT><![CDATA[SALE]]></TEXT>
<!--2BBAB937E0764391807D9F26E393D70E--> <FILENAME><![CDATA[/org/openbravo/retail/posterminal/ad_reports/CashUpReport.jrxml]]></FILENAME>
-<!--2BBAB937E0764391807D9F26E393D70E--> <ISUSED><![CDATA[Y]]></ISUSED>
+<!--2BBAB937E0764391807D9F26E393D70E--> <ISUSED><![CDATA[N]]></ISUSED>
<!--2BBAB937E0764391807D9F26E393D70E--> <AD_MODULE_ID><![CDATA[FF808181326CC34901326D53DBCF0018]]></AD_MODULE_ID>
<!--2BBAB937E0764391807D9F26E393D70E--></AD_TEXTINTERFACES>
@@ -18,7 +18,7 @@
<!--AC5F0FE08BF64378BB13926CA5E5DF6A--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
<!--AC5F0FE08BF64378BB13926CA5E5DF6A--> <TEXT><![CDATA[WITHDRAWAL]]></TEXT>
<!--AC5F0FE08BF64378BB13926CA5E5DF6A--> <FILENAME><![CDATA[/org/openbravo/retail/posterminal/ad_reports/CashUpReport.jrxml]]></FILENAME>
-<!--AC5F0FE08BF64378BB13926CA5E5DF6A--> <ISUSED><![CDATA[Y]]></ISUSED>
+<!--AC5F0FE08BF64378BB13926CA5E5DF6A--> <ISUSED><![CDATA[N]]></ISUSED>
<!--AC5F0FE08BF64378BB13926CA5E5DF6A--> <AD_MODULE_ID><![CDATA[FF808181326CC34901326D53DBCF0018]]></AD_MODULE_ID>
<!--AC5F0FE08BF64378BB13926CA5E5DF6A--></AD_TEXTINTERFACES>
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
@@ -152,6 +152,7 @@
// Quotations
"components/modalcreateorderfromquotation",
"components/modalreactivatequotation",
+ "components/modalrejectquotation",
// Detection of change in context
"components/modalcontextchanged",
"components/modalproductcharacteristic",
diff --git a/src/org/openbravo/retail/posterminal/QuotationsReject.java b/src/org/openbravo/retail/posterminal/QuotationsReject.java
new file mode 100644
--- /dev/null
+++ b/src/org/openbravo/retail/posterminal/QuotationsReject.java
@@ -0,0 +1,49 @@
+/*
+ ************************************************************************************
+ * Copyright (C) 2015 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.
+ ************************************************************************************
+ */
+
+package org.openbravo.retail.posterminal;
+
+import javax.servlet.ServletException;
+
+import org.codehaus.jettison.json.JSONArray;
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.model.common.order.Order;
+import org.openbravo.model.common.order.RejectReason;
+import org.openbravo.service.json.JsonConstants;
+
+public class QuotationsReject extends JSONProcessSimple {
+
+ @Override
+ public JSONObject exec(JSONObject jsonsent) throws JSONException, ServletException {
+ JSONObject result = new JSONObject();
+ OBContext.setAdminMode(true);
+ try {
+ String orderid = jsonsent.getString("orderid");
+ String rejectReasonId = jsonsent.getString("rejectReasonId");
+ Order order = OBDal.getInstance().get(Order.class, orderid);
+ RejectReason reason = OBDal.getInstance().get(RejectReason.class, rejectReasonId);
+ if (order != null && reason != null) {
+ order.setDocumentStatus("CJ");
+ order.setRejectReason(reason);
+ OBDal.getInstance().save(order);
+ }
+ JSONArray respArray = new JSONArray();
+ respArray.put(order);
+ result.put(JsonConstants.RESPONSE_DATA, respArray);
+ result.put(JsonConstants.RESPONSE_STATUS, JsonConstants.RPCREQUEST_STATUS_SUCCESS);
+ } finally {
+ OBContext.restorePreviousMode();
+ }
+ return result;
+ }
+
+}
diff --git a/src/org/openbravo/retail/posterminal/term/RejectReason.java b/src/org/openbravo/retail/posterminal/term/RejectReason.java
new file mode 100644
--- /dev/null
+++ b/src/org/openbravo/retail/posterminal/term/RejectReason.java
@@ -0,0 +1,35 @@
+/*
+ ************************************************************************************
+ * Copyright (C) 2015 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.
+ ************************************************************************************
+ */
+package org.openbravo.retail.posterminal.term;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.retail.posterminal.ProcessHQLQuery;
+
+public class RejectReason extends ProcessHQLQuery {
+
+ @Override
+ protected boolean isAdminMode() {
+ return true;
+ }
+
+ @Override
+ protected List<String> getQuery(JSONObject jsonsent) throws JSONException {
+ return Arrays
+ .asList(new String[] { "from RejectReason where active = 'Y' and $readableSimpleCriteria and $activeCriteria order by name" });
+ }
+
+ @Override
+ protected boolean bypassPreferenceCheck() {
+ return true;
+ }
+}
diff --git a/web/org.openbravo.retail.posterminal/js/components/menu.js b/web/org.openbravo.retail.posterminal/js/components/menu.js
--- a/web/org.openbravo.retail.posterminal/js/components/menu.js
+++ b/web/org.openbravo.retail.posterminal/js/components/menu.js
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2012 Openbravo S.L.U.
+ * Copyright (C) 2012-2015 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.
@@ -627,6 +627,53 @@
});
enyo.kind({
+ name: 'OB.UI.MenuRejectQuotation',
+ kind: 'OB.UI.MenuAction',
+ permission: 'OBPOS_quotation.rejections',
+ events: {
+ onShowRejectQuotation: ''
+ },
+ i18nLabel: 'OBPOS_RejectQuotation',
+ tap: function () {
+ if (this.disabled) {
+ return true;
+ }
+ this.inherited(arguments); // Manual dropdown menu closure
+ if (OB.MobileApp.model.hasPermission(this.permission, true)) {
+ this.doShowRejectQuotation();
+ }
+ },
+ updateVisibility: function (model) {
+ if (OB.MobileApp.model.hasPermission(this.permission, true) && model.get('isQuotation') && model.get('hasbeenpaid') === 'Y') {
+ this.show();
+ } else {
+ this.hide();
+ }
+ },
+ init: function (model) {
+ var receipt = model.get('order'),
+ me = this;
+ me.hide();
+
+ model.get('leftColumnViewManager').on('order', function () {
+ this.updateVisibility(receipt);
+ this.adjustVisibilityBasedOnPermissions();
+ }, this);
+
+ model.get('leftColumnViewManager').on('multiorder', function () {
+ me.hide();
+ }, this);
+
+ receipt.on('change:isQuotation', function (model) {
+ this.updateVisibility(model);
+ }, this);
+ receipt.on('change:hasbeenpaid', function (model) {
+ this.updateVisibility(model);
+ }, this);
+ }
+});
+
+enyo.kind({
name: 'OB.UI.MenuPaidReceipts',
kind: 'OB.UI.MenuAction',
permission: 'OBPOS_retail.paidReceipts',
diff --git a/web/org.openbravo.retail.posterminal/js/components/modalrejectquotation.js b/web/org.openbravo.retail.posterminal/js/components/modalrejectquotation.js
new file mode 100644
--- /dev/null
+++ b/web/org.openbravo.retail.posterminal/js/components/modalrejectquotation.js
@@ -0,0 +1,97 @@
+/*
+ ************************************************************************************
+ * Copyright (C) 2015 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 B, Backbone, $, _, enyo */
+
+enyo.kind({
+ kind: 'OB.UI.ModalDialogButton',
+ name: 'OB.OBPOSPointOfSale.UI.Modals.btnModalRejectQuotationCancel',
+ i18nContent: 'OBMOBC_LblCancel',
+ tap: function () {
+ this.doHideThisPopup();
+ }
+});
+enyo.kind({
+ kind: 'OB.UI.ModalDialogButton',
+ name: 'OB.OBPOSPointOfSale.UI.Modals.btnModalRejectQuotationAccept',
+ i18nContent: 'OBMOBC_LblOk',
+ events: {
+ onRejectQuotationDone: ''
+ },
+ tap: function () {
+ this.doRejectQuotationDone();
+ this.doHideThisPopup();
+ }
+});
+enyo.kind({
+ kind: 'OB.UI.List',
+ name: 'OB.UI.ModalRejectQuotationRejectReason',
+ classes: 'combo',
+ style: 'width: 80%',
+ renderLine: enyo.kind({
+ kind: 'enyo.Option',
+ initComponents: function () {
+ this.inherited(arguments);
+ this.setValue(this.model.get('id'));
+ this.setContent(this.model.get('_identifier'));
+ }
+ }),
+ renderEmpty: 'enyo.Control',
+ initComponents: function () {
+ this.setCollection(new Backbone.Collection());
+ }
+});
+
+
+enyo.kind({
+ kind: 'OB.UI.ModalAction',
+ name: 'OB.UI.ModalRejectQuotation',
+ myId: 'modalRejectQuotation',
+ bodyContent: {
+ components: [{
+ name: 'labelRejectReason',
+ style: 'text-align: right; padding-right:10px; width: 40%; height: 40px; float: left;'
+ }, {
+ style: 'width: 50%; float: left;',
+ kind: 'OB.UI.ModalRejectQuotationRejectReason',
+ name: 'rejectReason'
+ }]
+ },
+ i18nHeader: 'OBPOS_RejectQuotation',
+ bodyButtons: {
+ components: [{
+ kind: 'OB.OBPOSPointOfSale.UI.Modals.btnModalRejectQuotationAccept'
+ }, {
+ kind: 'OB.OBPOSPointOfSale.UI.Modals.btnModalRejectQuotationCancel'
+ }]
+ },
+ events: {
+ onRejectQuotation: ''
+ },
+ handlers: {
+ onRejectQuotationDone: 'doRejectQuotationDone'
+ },
+ doRejectQuotationDone: function () {
+ this.doRejectQuotation({
+ rejectReason: this.$.bodyContent.$.rejectReason.getValue()
+ });
+ },
+ initComponents: function () {
+ this.inherited(arguments);
+ this.$.bodyContent.$.labelRejectReason.setContent(OB.I18N.getLabel('OBPOS_lblRejectReason'));
+ var rejectReasonCollection = [];
+ _.each(OB.MobileApp.model.get('rejectReasons'), function (reason) {
+ rejectReasonCollection.push(new Backbone.Model({
+ id: reason.id,
+ _identifier: reason._identifier
+ }));
+ });
+ this.$.bodyContent.$.rejectReason.getCollection().reset(rejectReasonCollection);
+ }
+});
\ No newline at end of file
diff --git a/web/org.openbravo.retail.posterminal/js/login/model/login-model.js b/web/org.openbravo.retail.posterminal/js/login/model/login-model.js
--- a/web/org.openbravo.retail.posterminal/js/login/model/login-model.js
+++ b/web/org.openbravo.retail.posterminal/js/login/model/login-model.js
@@ -335,6 +335,22 @@
}
});
+ this.addPropertiesLoader({
+ properties: ['rejectReasons'],
+ loadFunction: function (terminalModel) {
+ OB.info('[terminal] Loading... ' + this.properties);
+ var me = this;
+ new OB.DS.Request('org.openbravo.retail.posterminal.term.RejectReason').exec(null, function (data) {
+ if (data && data.exception) {
+ terminalModel.set(me.properties[0], []);
+ } else {
+ terminalModel.set(me.properties[0], data);
+ }
+ terminalModel.propertiesReady(me.properties);
+ });
+ }
+ });
+
this.get('dataSyncModels').push({
name: 'Customer',
model: OB.Model.ChangedBusinessPartners,
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
@@ -1606,11 +1606,24 @@
this.set('id', null);
this.save();
},
-
- rejectQuotation: function () {
- OB.UTIL.showWarning('reject!!');
+ rejectQuotation: function (rejectReasonId, scope, callback) {
+ var process = new OB.DS.Process('org.openbravo.retail.posterminal.QuotationsReject');
+ OB.UTIL.showLoading(true);
+ process.exec({
+ orderid: this.get('id'),
+ rejectReasonId: rejectReasonId
+ }, function (data) {
+ OB.UTIL.showLoading(false);
+ if (!data || data.exception) {
+ OB.UTIL.showError(OB.I18N.getLabel('OBPOS_ErrRejectQuotation'));
+ } else {
+ OB.UTIL.showSuccess(OB.I18N.getLabel('OBPOS_SuccessRejectQuotation'));
+ }
+ if (callback) {
+ callback.call(scope, data !== null);
+ }
+ });
},
-
resetOrderInvoice: function () {
if (OB.MobileApp.model.hasPermission('OBPOS_receipt.invoice')) {
this.set('generateInvoice', false);
@@ -2090,8 +2103,6 @@
silent: true
});
},
-
-
// for each line, decrease the qtyOffer of promotions and remove the lines with qty 0
removeQtyOffer: function () {
var linesPending = new Backbone.Collection();
@@ -2169,7 +2180,6 @@
return false;
}
},
-
// if there is a promtion of type "applyNext" that it has been applied previously in the line, then It is replaced
// by the first promotion applied. Ex:
// Ex: prod1 - qty 5 - disc3x2 & discPriceAdj -> priceAdj is applied first to 5 units
@@ -2224,7 +2234,6 @@
desc += ']';
return desc;
}
-
});
var OrderList = Backbone.Collection.extend({
diff --git a/web/org.openbravo.retail.posterminal/js/pointofsale/view/pointofsale.js b/web/org.openbravo.retail.posterminal/js/pointofsale/view/pointofsale.js
--- a/web/org.openbravo.retail.posterminal/js/pointofsale/view/pointofsale.js
+++ b/web/org.openbravo.retail.posterminal/js/pointofsale/view/pointofsale.js
@@ -26,6 +26,7 @@
onShowCreateOrderPopup: 'showCreateOrderPopup',
onReactivateQuotation: 'reactivateQuotation',
onShowReactivateQuotation: 'showReactivateQuotation',
+ onShowRejectQuotation: 'showRejectQuotation',
onRejectQuotation: 'rejectQuotation',
onQuotations: 'quotations',
onShowDivText: 'showDivText',
@@ -141,6 +142,9 @@
kind: 'OB.UI.ModalReactivateQuotation',
name: 'modalReactivateQuotation'
}, {
+ kind: 'OB.UI.ModalRejectQuotation',
+ name: 'modalRejectQuotation'
+ }, {
kind: 'OB.UI.ModalReceiptPropertiesImpl',
name: 'receiptPropertiesDialog'
}, {
@@ -198,9 +202,9 @@
kind: 'OB.OBPOSPointOfSale.UI.Modals.ModalPaymentsSelect',
name: 'modalPaymentsSelect'
}, {
- kind: 'OB.UI.ModalModulesInDev',
- name: 'modalModulesInDev'
- }]
+ kind: 'OB.UI.ModalModulesInDev',
+ name: 'modalModulesInDev'
+ }]
}, {
name: 'mainSubWindow',
isMainSubWindow: true,
@@ -512,14 +516,23 @@
});
},
+ showRejectQuotation: function () {
+ this.doShowPopup({
+ popup: 'modalRejectQuotation'
+ });
+ },
+
reactivateQuotation: function () {
this.model.get('order').reactivateQuotation();
this.model.get('orderList').saveCurrent();
return true;
},
- rejectQuotation: function () {
- this.model.get('order').rejectQuotation();
- this.model.get('orderList').saveCurrent();
+ rejectQuotation: function (inSender, inEvent) {
+ this.model.get('order').rejectQuotation(inEvent.rejectReason, this, function (success) {
+ if (success) {
+ this.deleteCurrentOrder(inSender, inEvent);
+ }
+ });
return true;
},
showDivText: function (inSender, inEvent) {
diff --git a/web/org.openbravo.retail.posterminal/js/pointofsale/view/toolbar-left.js b/web/org.openbravo.retail.posterminal/js/pointofsale/view/toolbar-left.js
--- a/web/org.openbravo.retail.posterminal/js/pointofsale/view/toolbar-left.js
+++ b/web/org.openbravo.retail.posterminal/js/pointofsale/view/toolbar-left.js
@@ -450,6 +450,10 @@
});
this.menuEntries.push({
+ kind: 'OB.UI.MenuRejectQuotation'
+ });
+
+ this.menuEntries.push({
kind: 'OB.UI.MenuCreateOrderFromQuotation'
});
sample.data.diff [^] (2,038 bytes) 2015-05-27 16:54 [Show Content] [Hide Content]diff --git a/referencedata/sampledata/The_White_Valley_Group/C_REJECT_REASON.xml b/referencedata/sampledata/The_White_Valley_Group/C_REJECT_REASON.xml
new file mode 100644
--- /dev/null
+++ b/referencedata/sampledata/The_White_Valley_Group/C_REJECT_REASON.xml
@@ -0,0 +1,42 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<data>
+<C_REJECT_REASON>
+ <C_REJECT_REASON_ID><![CDATA[7B53AE732A31416E8879F5849F45F7DC]]></C_REJECT_REASON_ID>
+ <AD_CLIENT_ID><![CDATA[39363B0921BB4293B48383844325E84C]]></AD_CLIENT_ID>
+ <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+ <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+ <CREATED><![CDATA[2015-05-27 09:39:00.478]]></CREATED>
+ <CREATEDBY><![CDATA[100]]></CREATEDBY>
+ <UPDATED><![CDATA[2015-05-27 14:04:09.818]]></UPDATED>
+ <UPDATEDBY><![CDATA[100]]></UPDATEDBY>
+ <VALUE><![CDATA[REJECT_2]]></VALUE>
+ <NAME><![CDATA[Reject reason 2]]></NAME>
+</C_REJECT_REASON>
+
+<C_REJECT_REASON>
+ <C_REJECT_REASON_ID><![CDATA[9711297358A14DADA5A787E032AF2F5E]]></C_REJECT_REASON_ID>
+ <AD_CLIENT_ID><![CDATA[39363B0921BB4293B48383844325E84C]]></AD_CLIENT_ID>
+ <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+ <ISACTIVE><![CDATA[N]]></ISACTIVE>
+ <CREATED><![CDATA[2015-05-27 14:04:28.058]]></CREATED>
+ <CREATEDBY><![CDATA[100]]></CREATEDBY>
+ <UPDATED><![CDATA[2015-05-27 14:04:28.058]]></UPDATED>
+ <UPDATEDBY><![CDATA[100]]></UPDATEDBY>
+ <VALUE><![CDATA[REJECT_3]]></VALUE>
+ <NAME><![CDATA[Reject reason 3]]></NAME>
+</C_REJECT_REASON>
+
+<C_REJECT_REASON>
+ <C_REJECT_REASON_ID><![CDATA[BE8B7D78615D48BFBC27FF1F0C9789C7]]></C_REJECT_REASON_ID>
+ <AD_CLIENT_ID><![CDATA[39363B0921BB4293B48383844325E84C]]></AD_CLIENT_ID>
+ <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+ <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+ <CREATED><![CDATA[2015-05-27 09:38:48.273]]></CREATED>
+ <CREATEDBY><![CDATA[100]]></CREATEDBY>
+ <UPDATED><![CDATA[2015-05-27 14:04:01.477]]></UPDATED>
+ <UPDATEDBY><![CDATA[100]]></UPDATEDBY>
+ <VALUE><![CDATA[REJECT_1]]></VALUE>
+ <NAME><![CDATA[Reject reason 1]]></NAME>
+</C_REJECT_REASON>
+
+</data>
test_quotations.diff [^] (5,593 bytes) 2015-09-08 18:48 [Show Content] [Hide Content]diff --git a/src-test/org/openbravo/test/mobile/common/selenium/javascript/TestId.java b/src-test/org/openbravo/test/mobile/common/selenium/javascript/TestId.java
--- a/src-test/org/openbravo/test/mobile/common/selenium/javascript/TestId.java
+++ b/src-test/org/openbravo/test/mobile/common/selenium/javascript/TestId.java
@@ -124,6 +124,7 @@
BUTTON_MENU_LAYAWAYTHISRECEIPT("menuScroller_menuLayaway", EnyoKind.BUTTON), //
BUTTON_MENU_RECEIPTS("menuScroller_menuPaidReceipts", EnyoKind.BUTTON), //
BUTTON_MENU_QUOTATIONS("menuScroller_menuQuotations", EnyoKind.BUTTON), //
+ BUTTON_MENU_REJECTQUOTATIONS("menuScroller_menuRejectQuotation", EnyoKind.BUTTON), //
BUTTON_MENU_RECEIPTDISCOUNTS("menuScroller_menuDiscounts", EnyoKind.BUTTON), //
BUTTON_MENU_CREATEQUOTATION("menuScroller_menuQuotation", EnyoKind.BUTTON), //
BUTTON_MENU_LAYAWAYS("menuScroller_menuLayaways", EnyoKind.BUTTON), //
@@ -366,6 +367,10 @@
// LABEL_QUOTATIONS_TITLE("modalPaidReceipts_header"), //
BUTTON_QUOTATIONS_SEARCH("prslistitemprinter_smallButton2", EnyoKind.BUTTON), //
BUTTON_QUOTATIONS_ROW1("prslistitemprinter_row1_listPRsLine", EnyoKind.BUTTON), //
+ BUTTON_QUOTATIONS_REJECT_OK("bodyButtons_btnModalRejectQuotationAccept", EnyoKind.BUTTON), //
+ SELECT_QUOTATIONS_REJECT_REASON("bodyContent_rejectReason", EnyoKind.BUTTON), //
+ SELECT_QUOTATIONS_REJECT_REASON_OPTION1("rejectReason_3", EnyoKind.BUTTON), //
+ SELECT_QUOTATIONS_REJECT_REASON_OPTION2("rejectReason_4", EnyoKind.BUTTON), //
// Layaways
// LABEL_LAYAWAYS_TITLE("modalPaidReceipts_header"), //
diff --git a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/quotations/RejectQuotations.java b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/quotations/RejectQuotations.java
new file mode 100644
--- /dev/null
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/quotations/RejectQuotations.java
@@ -0,0 +1,104 @@
+package org.openbravo.test.mobile.retail.pack.selenium.tests.quotations;
+
+import static org.junit.Assert.assertEquals;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.junit.Test;
+import org.openbravo.test.mobile.common.selenium.database.DatabaseHelperSelect;
+import org.openbravo.test.mobile.common.selenium.javascript.TestId;
+import org.openbravo.test.mobile.common.selenium.terminals.WebPOSTerminalHelper;
+import org.openbravo.test.mobile.common.selenium.utils.Utils;
+
+public class RejectQuotations extends WebPOSTerminalHelper {
+
+ @Test
+ public void test() {
+ logger.info("Initial state");
+
+ logger.info("Create 2 quotations");
+ createQuotation();
+ createQuotation();
+
+ logger.info("Load quotation 1");
+ String documentNo1 = loadQuotation();
+ logger.info("Quotation 1 DocumentNo = " + documentNo1);
+
+ logger.info("Reject quotation 1");
+ tap(TestId.BUTTON_MENU);
+ tap(TestId.BUTTON_MENU_REJECTQUOTATIONS);
+ Utils.pause(1000);
+ TestId.SELECT_QUOTATIONS_REJECT_REASON.enyoNode().executeExtension(".setSelected(0)");
+ verify(TestId.SELECT_QUOTATIONS_REJECT_REASON_OPTION1, "Reject reason 1");
+ tap(TestId.BUTTON_QUOTATIONS_REJECT_OK);
+
+ logger.info("Load quotation 2");
+ String documentNo2 = loadQuotation();
+ logger.info("Quotation 2 DocumentNo = " + documentNo2);
+
+ logger.info("Reject quotation 2");
+ tap(TestId.BUTTON_MENU);
+ tap(TestId.BUTTON_MENU_REJECTQUOTATIONS);
+ Utils.pause(1000);
+ TestId.SELECT_QUOTATIONS_REJECT_REASON.enyoNode().executeExtension(".setSelected(1)");
+ verify(TestId.SELECT_QUOTATIONS_REJECT_REASON_OPTION2, "Reject reason 2");
+ tap(TestId.BUTTON_QUOTATIONS_REJECT_OK);
+
+ logger.info("Remove quotation from editor");
+ tap(TestId.BUTTON_DELETERECEIPT);
+ tap(TestId.BUTTON_DELETERECEIPT);
+
+ logger.info("Verify if quotations are rejected");
+ Utils.pause(1000);
+ verifyRejected(documentNo1, "REJECT_1");
+ verifyRejected(documentNo2, "REJECT_2");
+ }
+
+ private void createQuotation() {
+ // create quotation
+ tap(TestId.BUTTON_MENU);
+ tap(TestId.BUTTON_MENU_CREATEQUOTATION);
+
+ // add a product
+ tap(TestId.BUTTON_CATEGORY_BACKPACKSANDTRAVEL);
+ tap(TestId.BUTTON_PRODUCT_BACKPACKSANDTRAVEL_WHISTLE);
+ isDisabled(TestId.BUTTON_PAY, false);
+
+ // Tap pay
+ tap(TestId.BUTTON_PAY);
+ Utils.pause(1000);
+ }
+
+ private String loadQuotation() {
+ tap(TestId.BUTTON_MENU);
+ tap(TestId.BUTTON_MENU_QUOTATIONS);
+ tap(TestId.BUTTON_QUOTATIONS_SEARCH);
+ tap(TestId.BUTTON_QUOTATIONS_ROW1);
+ Utils.pause(1000);
+ String documentNo = get(TestId.LABEL_DOCUMENTNUMBER);
+ documentNo = documentNo.split(" - ")[1].trim();
+ return documentNo;
+ }
+
+ private void verifyRejected(final String documentNo, final String rejectReason) {
+ // verifications VI. payment details
+ final String sql = "SELECT C.docstatus, R.value FROM C_Order C"
+ + " INNER JOIN C_Reject_Reason R ON C.c_reject_reason_id = R.c_reject_reason_id"
+ + " WHERE C.documentno = '" + documentNo + "'";
+
+ new DatabaseHelperSelect() {
+ @Override
+ protected void yieldResultSet(final ResultSet rs) throws SQLException {
+ final String docstatus = rs.getString("docstatus");
+ final String value = rs.getString("value");
+ logger.info("Verifying rejected quotation in the backend: " + documentNo + ", " + docstatus
+ + ", " + value);
+
+ assertEquals("CJ", docstatus);
+ assertEquals(rejectReason, value);
+ }
+ }.execute(sql, 1);
+
+ }
+}
|