(0114873)
|
hgbot
|
2019-10-01 11:54
|
|
Repository: erp/devel/pi
Changeset: 4c75a4b806b563a36125cf649a9105b5a1d8b571
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Oct 01 11:52:58 2019 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/4c75a4b806b563a36125cf649a9105b5a1d8b571 [^]
Fixes issue 41900: Improves product characteristic filter of Manage Variants
The problem was how the criteria is sent when several characteristics are selected in the product
characteristics filter of the Manage Variantes grid. It looks like this:
{
criteria:{
"isProductCharacteristicsCriteria":true,
"criteria":[
{
"operator":"exists",
"fieldName":"characteristicDescription",
"value":[
"1A510FE566DB4E86A89D89A23ED484A1"
],
"existsQuery":"exists (from ProductCharacteristicValue v where e.product = v.product and v.characteristicValue.id in ($value))"
},
{
"operator":"exists",
"fieldName":"characteristicDescription",
"value":[
"EBBE95AD49DA4C3D9A241DF353583C72"
],
"existsQuery":"exists (from ProductCharacteristicValue v where e.product = v.product and v.characteristicValue.id in ($value))"
}
]
}
}
Because the Managa Variants datasource is manual, it is limited in the type of filters it supports.
This particular case is fixed by using the inner criteria to filter:
"criteria":[
{
"operator":"exists",
"fieldName":"characteristicDescription",
"value":[
"1A510FE566DB4E86A89D89A23ED484A1"
],
"existsQuery":"exists (from ProductCharacteristicValue v where e.product = v.product and v.characteristicValue.id in ($value))"
},
{
"operator":"exists",
"fieldName":"characteristicDescription",
"value":[
"EBBE95AD49DA4C3D9A241DF353583C72"
],
"existsQuery":"exists (from ProductCharacteristicValue v where e.product = v.product and v.characteristicValue.id in ($value))"
}
]
This replacement is done if there is only one element in the outer criteria, and if it contains isProductCharacteristicsCriteria
property is true.
If there are more elements in the outer criteria, then the incoming criteria is already formatted as the
Manage Variants datasource expects:
criteria: {"fieldName":"name","operator":"iContains","value":"test"}
criteria: {"operator":"exists","fieldName":"characteristicDescription","value":["1A510FE566DB4E86A89D89A23ED484A1"],"existsQuery":"exists (from ProductCharacteristicValue v where e.product = v.product and v.characteristicValue.id in ($value))"}
criteria: {"operator":"exists","fieldName":"characteristicDescription","value":["EBBE95AD49DA4C3D9A241DF353583C72"],"existsQuery":"exists (from ProductCharacteristicValue v where e.product = v.product and v.characteristicValue.id in ($value))"}
---
M src/org/openbravo/materialmgmt/ManageVariantsDS.java
---
|
|