
# HG changeset patch
# User Guillermo Alvarez de Eulate <guillermo.alvarez@openbravo.com>
# Date 1507880473 -7200
# Node ID acaab0e5f2d817b8740a605eb6ae1fdacf9699e4
# Parent  a5a8157400e3fa9ec0493a5b9b6cb9affde30321
Related to issue 36966: AttValue info retrieved from server y now a json object

- Receive attValue information taking into account new format
- Generate attDescription based on json information
- Compare the input inserted by the user with the attDescription

diff -r a5a8157400e3 -r acaab0e5f2d8 web/org.openbravo.retail.returns/js/modalReturnLines.js
--- a/web/org.openbravo.retail.returns/js/modalReturnLines.js	Tue Oct 03 05:55:55 2017 +0000
+++ b/web/org.openbravo.retail.returns/js/modalReturnLines.js	Fri Oct 13 09:41:13 2017 +0200
@@ -151,7 +151,7 @@
     }, {
       name: 'attribute',
       classes: 'span4',
-      style: 'line-height: 35px; font-size: 17px; width: 180px;'
+      style: 'line-height: 35px; font-size: 17px; width: 180px; text-align: left;'
     }, {
       name: 'totalQuantity',
       classes: 'span2',
@@ -297,7 +297,31 @@
       }
       this.$.product.setContent(this.newAttribute.name);
       if (OB.MobileApp.model.hasPermission('OBPOS_EnableSupportForProductAttributes', true)) {
-        this.$.attribute.setContent(this.newAttribute.attributeValue ? this.newAttribute.attributeValue : 'NA');
+        if (this.newAttribute.attributeValue && _.isString(this.newAttribute.attributeValue)) {
+          var jsonAttValues = JSON.parse(this.newAttribute.attributeValue);
+
+          var attSetInstanceDescription = '';
+          _.each(
+          _.keys(jsonAttValues), function (key) {
+            var currentValue = jsonAttValues[key];
+            var attValueContent = '';
+            if (jsonAttValues && currentValue) {
+              attValueContent += currentValue.label ? currentValue.label : currentValue.name;
+              attValueContent += ': ';
+              attValueContent += currentValue.value;
+              attSetInstanceDescription += currentValue.value + "_";
+              this.$.attribute.createComponent({
+                content: attValueContent
+              });
+            }
+          }, this);
+          if (attSetInstanceDescription && attSetInstanceDescription.length > 1) {
+            attSetInstanceDescription = attSetInstanceDescription.substring(0, attSetInstanceDescription.length - 1);
+          }
+          this.newAttribute.attSetInstanceDesc = attSetInstanceDescription;
+        } else {
+          this.$.attribute.setContent('NA');
+        }
       } else {
         this.$.attribute.hide();
       }
diff -r a5a8157400e3 -r acaab0e5f2d8 web/org.openbravo.retail.returns/js/modalproductattributeverifiedreturns.js
--- a/web/org.openbravo.retail.returns/js/modalproductattributeverifiedreturns.js	Tue Oct 03 05:55:55 2017 +0000
+++ b/web/org.openbravo.retail.returns/js/modalproductattributeverifiedreturns.js	Fri Oct 13 09:41:13 2017 +0200
@@ -116,12 +116,12 @@
   fieldChanged: function (inSender, inEvent) {
     var me = this,
         line = me.args.line,
-        validAttribute, orderlineAttribute, orderlineProduct, inpProduct, inpAttribute, lineIndex, focusIndex;
+        validAttribute, orderlineAttribute, orderlineProduct, inpProduct, inpAttribute, lineIndex, focusIndex, transformedAttValue;
     lineIndex = 0;
     line.forEach(function (theLine) {
       validAttribute = false;
       orderlineProduct = theLine.id;
-      orderlineAttribute = theLine.attributeValue;
+      orderlineAttribute = theLine.attSetInstanceDesc;
       inpProduct = me.$.bodyContent.$.verifiedReturns.$['returnLine' + lineIndex].$.productId.getContent();
       inpAttribute = me.$.bodyContent.$.verifiedReturns.$['returnLine' + lineIndex].$.valueAttribute.getValue();
       if (inpAttribute) {

