details: https://code.openbravo.com/erp/devel/pi/rev/20a10750ce14 changeset: 21108:20a10750ce14 user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Wed Sep 11 09:02:44 2013 +0200 summary: related to bug 24735: characteristics filter not working in product selector
Properly set operator type in OBCharacteristicsFilterItem, so DynamicForm.shouldApplyCriterionToItem method is able correctly evaluate whether the criterion is managed by that item. If operator type is default (iContains), shouldApplyCriterionToItem cannot properly determine the item managing the criterion, resulting in some cases it to be stored in _extraAdvancedCriteria to be preserved as a non directly editable filter, appending in this way new criterions to previous one. details: https://code.openbravo.com/erp/devel/pi/rev/28e99892996e changeset: 21109:28e99892996e user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Wed Sep 11 10:09:07 2013 +0200 summary: fixed bug 24735: characteristics filter only works in product window or selector HQL query to be executed needs to determine product property in the entity that is being filtered. Now this is determined based on field name path, previously it was hardcoded for the two working cases (product window and product selector) diffstat: modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-characteristics.js | 29 +++++---- 1 files changed, 16 insertions(+), 13 deletions(-) diffs (55 lines): diff -r 7eada4720c21 -r 28e99892996e 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 Tue Sep 10 11:36:05 2013 +0200 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-characteristics.js Wed Sep 11 10:09:07 2013 +0200 @@ -379,11 +379,10 @@ }); isc.OBCharacteristicsFilterItem.addProperties({ + operator: 'exists', canEdit: false, disableIconsOnReadOnly: false, - defaultHqlExists: 'exists (from ProductCharacteristicValue v where e = v.product and v.characteristicValue.id in ($value))', - productSelectorHqlExists: 'exists (from ProductCharacteristicValue v where e.product = v.product and v.characteristicValue.id in ($value))', - productSelectorID: '2E64F551C7C4470C80C29DBA24B34A5F', + hqlExists: 'exists (from ProductCharacteristicValue v where {productInEntity} = v.product and v.characteristicValue.id in ($value))', showPickerIcon: false, filterDialogConstructor: isc.OBCharacteristicsFilterDialog, pickerIconDefaults: { @@ -448,16 +447,7 @@ value: inValues }; - if (this.selectorWindow // - && this.selectorWindow.selectorGrid // - && this.selectorWindow.selectorGrid.dataSource // - && this.selectorWindow.selectorGrid.dataSource.dataURL !== (OB.Application.contextUrl + 'org.openbravo.model.common.plm/Product')) { // - //if (this.selectorWindow && this.selectorWindow.selector && this.selectorWindow.selector.selectorDefinitionId === this.productSelectorID) { - charCriteria.existsQuery = this.productSelectorHqlExists; - } else { - charCriteria.existsQuery = this.defaultHqlExists; - } - + charCriteria.existsQuery = this.hqlExists; result.criteria.push(charCriteria); } } @@ -485,6 +475,19 @@ }, init: function () { + var propertyPath, propertyName, i; + + // Getting the product property in the entity we are filtering it. + // It is obtained based on fieldName, in case its path is compound (i.e. + // product$characteristicDescription), path is included up to the element + // previous to the last one + propertyName = 'e'; // "e" is the base entity + propertyPath = this.getFieldName().split(OB.Constants.FIELDSEPARATOR); + for (i = 0; i < propertyPath.length - 1; i++) { + propertyName += '.' + propertyPath[i]; + } + this.hqlExists = this.hqlExists.replace('{productInEntity}', propertyName); + this.addAutoChild('filterDialog', { title: this.title, callback: this.getID() + '.filterDialogCallback(value)' ------------------------------------------------------------------------------ How ServiceNow helps IT people transform IT departments: 1. Consolidate legacy IT systems to a single system of record for IT 2. Standardize and globalize service processes across IT 3. Implement zero-touch automation to replace manual, redundant tasks http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits