# HG changeset patch
# User Unai Martirena <unai.martirena@openbravo.com>
# Date 1456488584 -3600
#      Fri Feb 26 13:09:44 2016 +0100
# Node ID f5ab7bbfc9cd943aa76ac9e0a61ca87e3bb4fef2
# Parent  962eab45efce69ff95aed5bf4214c68da6f1c0a3
Fixes bug 32358: Fix javascript error with mandatory proposal services when adding packs

diff --git a/web/org.openbravo.retail.posterminal/js/pointofsale/view/editline.js b/web/org.openbravo.retail.posterminal/js/pointofsale/view/editline.js
--- a/web/org.openbravo.retail.posterminal/js/pointofsale/view/editline.js
+++ b/web/org.openbravo.retail.posterminal/js/pointofsale/view/editline.js
@@ -529,7 +529,7 @@
     }
   },
   toggleLineSelection: function (inSender, inEvent) {
-    if (inEvent.status) {
+    if (inEvent.status && this.line) {
       this.selectedLine = this.line;
       this.line = null;
       this.selectedCallbacks = this.receipt.get('lines')._callbacks.selected;
@@ -537,7 +537,7 @@
       this.receipt.get('lines').off('selected');
       this.receipt.get('lines').off('click');
       this.render();
-    } else {
+    } else if (!inEvent.status) {
       //The fix for issue 31509 adds a selected callback after 'off'ing the callbacks but before
       //restoring them. We need to ensure that both callback objects are merged
       this.receipt.get('lines')._callbacks.selected.tail.next = this.selectedCallbacks.next.next;
