Attached Files | diff22471disabledmenuitems.diff [^] (6,077 bytes) 2012-12-06 11:54 [Show Content] [Hide Content]diff -r bb09005ab60a web/org.openbravo.retail.posterminal/js/components/commonbuttons.js
--- a/web/org.openbravo.retail.posterminal/js/components/commonbuttons.js Wed Dec 05 11:07:15 2012 +0100
+++ b/web/org.openbravo.retail.posterminal/js/components/commonbuttons.js Thu Dec 06 11:53:51 2012 +0100
@@ -492,12 +492,12 @@
classes: 'dropdown-menuitem'
}],
setDisabled: function (value) {
+ this.disabled = value;
if (value) {
this.addClass('disabled');
} else {
this.removeClass('disabled');
}
- this.isDisabled = value;
},
initComponents: function () {
this.inherited(arguments);
diff -r bb09005ab60a web/org.openbravo.retail.posterminal/js/components/menu.js
--- a/web/org.openbravo.retail.posterminal/js/components/menu.js Wed Dec 05 11:07:15 2012 +0100
+++ b/web/org.openbravo.retail.posterminal/js/components/menu.js Thu Dec 06 11:53:51 2012 +0100
@@ -49,6 +49,9 @@
},
label: OB.I18N.getLabel('OBPOS_LblReturn'),
tap: function () {
+ if (this.disabled) {
+ return true;
+ }
this.parent.hide(); // Manual dropdown menu closure
this.doShowReturnText();
},
@@ -84,6 +87,9 @@
},
label: OB.I18N.getLabel('OBPOS_LblProperties'),
tap: function () {
+ if (this.disabled) {
+ return true;
+ }
this.parent.hide(); // Manual dropdown menu closure
this.doShowReceiptProperties();
},
@@ -110,6 +116,9 @@
},
label: OB.I18N.getLabel('OBPOS_LblInvoice'),
tap: function () {
+ if (this.disabled) {
+ return true;
+ }
this.parent.hide(); // Manual dropdown menu closure
this.doReceiptToInvoice();
},
@@ -145,6 +154,9 @@
},
label: 'Customers',
tap: function () {
+ if (this.disabled) {
+ return true;
+ }
this.parent.hide(); // Manual dropdown menu closure
this.doChangeSubWindow({
newWindow: {
@@ -166,6 +178,9 @@
},
label: OB.I18N.getLabel('OBPOS_LblPrintReceipt'),
tap: function () {
+ if (this.disabled) {
+ return true;
+ }
this.parent.hide(); // Manual dropdown menu closure
if (OB.POS.modelterminal.hasPermission(this.permission)) {
this.doPrintReceipt();
@@ -193,6 +208,9 @@
},
label: OB.I18N.getLabel('OBPOS_CreateQuotation'),
tap: function () {
+ if (this.disabled) {
+ return true;
+ }
this.parent.hide(); // Manual dropdown menu closure
if (OB.POS.modelterminal.get('terminal').terminalType.documentTypeForQuotations) {
if (OB.POS.modelterminal.hasPermission(this.permission)) {
@@ -222,31 +240,31 @@
name: 'OB.UI.MenuDiscounts',
kind: 'OB.UI.MenuAction',
permission: 'OBPOS_retail.advDiscounts',
- relatedPermission: 'OBPOS_order.discount',
events: {
onDiscountsMode: ''
},
//TODO
label: 'Ticket discounts',
tap: function () {
- if (!this.isDisabled) {
- this.parent.hide(); // Manual dropdown menu closure
- this.doDiscountsMode({
- tabPanel: 'edit',
- keyboard: 'toolbardiscounts',
- edit: false,
- options: {
- discounts: true
- }
- });
+ if (this.disabled) {
+ return true;
}
+ this.parent.hide(); // Manual dropdown menu closure
+ this.doDiscountsMode({
+ tabPanel: 'edit',
+ keyboard: 'toolbardiscounts',
+ edit: false,
+ options: {
+ discounts: true
+ }
+ });
},
init: function (model) {
var me = this;
this.receipt = model.get('order');
//set disabled until ticket has lines
me.setDisabled(true);
- if (!OB.POS.modelterminal.hasPermission(this.permission) || !OB.POS.modelterminal.hasPermission(this.relatedPermission)) {
+ if (!OB.POS.modelterminal.hasPermission(this.permission)) {
//no permissions, never will be enabled
return;
}
@@ -276,6 +294,9 @@
},
label: OB.I18N.getLabel('OBPOS_CreateOrderFromQuotation'),
tap: function () {
+ if (this.disabled) {
+ return true;
+ }
if (OB.POS.modelterminal.hasPermission(this.permission)) {
this.parent.hide(); // Manual dropdown menu closure
this.doShowPopup({
@@ -312,6 +333,9 @@
},
label: OB.I18N.getLabel('OBPOS_RejectQuotation'),
tap: function () {
+ if (this.disabled) {
+ return true;
+ }
this.parent.hide(); // Manual dropdown menu closure
if (OB.POS.modelterminal.hasPermission(this.permission)) {
this.doRejectQuotation();
@@ -345,6 +369,9 @@
},
label: OB.I18N.getLabel('OBPOS_ReactivateQuotation'),
tap: function () {
+ if (this.disabled) {
+ return true;
+ }
this.parent.hide(); // Manual dropdown menu closure
if (OB.POS.modelterminal.hasPermission(this.permission)) {
this.doShowReactivateQuotation();
@@ -384,6 +411,9 @@
},
label: OB.I18N.getLabel('OBPOS_LblPaidReceipts'),
tap: function () {
+ if (this.disabled) {
+ return true;
+ }
this.parent.hide(); // Manual dropdown menu closure
if (!OB.POS.modelterminal.get('connectedToERP')) {
OB.UTIL.showError(OB.I18N.getLabel('OBPOS_OfflineWindowRequiresOnline'));
@@ -404,6 +434,9 @@
},
label: OB.I18N.getLabel('OBPOS_Quotations'),
tap: function () {
+ if (this.disabled) {
+ return true;
+ }
this.parent.hide(); // Manual dropdown menu closure
if (!OB.POS.modelterminal.get('connectedToERP')) {
OB.UTIL.showError(OB.I18N.getLabel('OBPOS_OfflineWindowRequiresOnline'));
@@ -425,6 +458,9 @@
},
label: OB.I18N.getLabel('OBPOS_LblOpenbravoWorkspace'),
tap: function () {
+ if (this.disabled) {
+ return true;
+ }
this.parent.hide(); // Manual dropdown menu closure
if (OB.POS.modelterminal.hasPermission(this.permission)) {
this.doBackOffice({
@@ -516,6 +552,9 @@
kind: 'OB.UI.MenuAction',
name: 'OB.UI.MenuItem',
tap: function () {
+ if (this.disabled) {
+ return true;
+ }
this.parent.hide(); // Manual dropdown menu closure
if (OB.POS.modelterminal.isWindowOnline(this.route) === true) {
if (!OB.POS.modelterminal.get('connectedToERP')) {
|