details:   https://code.openbravo.com/erp/devel/pi/rev/f2979bad6889
changeset: 33920:f2979bad6889
user:      Javier Armendáriz <javier.armendariz <at> openbravo.com>
date:      Mon Apr 30 14:07:14 2018 +0200
summary:   Fixed bug 38422: Characteristic description selector not working 
with filter.

Product characteristics filter assumes the parentGridEntity is always a Product,
but for the Add Product dialog, it is a ProductWithCharacteristics entity. In 
this
case it is needed to add a reference to a Product instance to make filtering
work as expected.

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-characteristics.js
 |  22 +++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diffs (46 lines):

diff -r e298e83db301 -r f2979bad6889 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-characteristics.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-characteristics.js
     Fri May 04 09:13:06 2018 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-characteristics.js
     Mon Apr 30 14:07:14 2018 +0200
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2013-2016 Openbravo SLU
+ * All portions are Copyright (C) 2013-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -527,6 +527,9 @@
     // previous to the last one 
     if (this.grid && this.grid.parentElement && 
this.grid.parentElement.viewProperties && 
this.grid.parentElement.viewProperties.gridProperties && 
this.grid.parentElement.viewProperties.gridProperties.alias) {
       this.propertyName = 
this.grid.parentElement.viewProperties.gridProperties.alias;
+      if (!this.isProductEntity()) {
+        this.propertyName += '.product';
+      }
     } else {
       this.propertyName = 'e'; // "e" is the base entity
     }
@@ -566,6 +569,23 @@
     this.Super('init', arguments);
   },
 
+  isProductEntity: function () {
+    var entity, theGrid;
+
+    if (this.grid && !this.grid.sourceWidget) {
+      return false; // can not retrieve entity
+    }
+    theGrid = this.grid.sourceWidget;
+    if (theGrid.view && theGrid.view.entity) {
+      // Standard view
+      entity = theGrid.view.entity;
+    } else if (theGrid.viewProperties && theGrid.viewProperties.entity) {
+      // Pick and Edit view
+      entity = theGrid.viewProperties.entity;
+    }
+    return entity === 'Product';
+  },
+
   removeProductCharacteristicsCriteria: function (fullCriteria) {
     var newCriteria = isc.shallowClone(fullCriteria);
     if (fullCriteria.criteria && 
fullCriteria.criteria.find('isProductCharacteristicsCriteria', true)) {

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to