Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0041900Openbravo ERP07. Sales managementpublic2019-09-30 11:272019-12-12 23:00
francisco 
AugustoMauch 
highmajoralways
closedfixed 
5
 
3.0PR20Q2 
Sandrahuguet
Core
No
0041900: In Product Characteristics, the Manage variants filter, in doesn't filter for more than one characteristics
In the tab Characteristics, in Product window, when click in the Manage Variants button it doesn't filter for more than one characteristic.
Tested in retail_pi_pgsql:
Go to product window
Create a new product
Click the flag is generic
Go to characteristics tab
Create size and color Characteristics, check the Variant flag.
Add a couple values for each characteristic in the Characteristic Configuration subtab (i.e. Black, Blue for color, M, L for size)
Click in Manage Variant button
Filter by Characteristic Descriptions:
    filter by color first,Black
    It filters ok
    Add a second filter size M
    It is not taking the second filter, only the color

No tags attached.
has duplicate defect 0048166 closed Triage Platform Base Impossible to add multiple filter in Manage Variant screen (Characteristic Description filter) 
Issue History
2019-09-30 11:27franciscoNew Issue
2019-09-30 11:27franciscoAssigned To => Triage Finance
2019-09-30 11:27franciscoModules => Core
2019-09-30 11:27franciscoResolution time => 1571608800
2019-09-30 11:27franciscoTriggers an Emergency Pack => No
2019-09-30 11:29PracticsIssue Monitored: Practics
2019-09-30 15:42SandrahuguetAssigned ToTriage Finance => markmm82
2019-09-30 15:43markmm82Statusnew => scheduled
2019-09-30 16:55SandrahuguetStatusscheduled => feedback
2019-09-30 16:58SandrahuguetStatusfeedback => new
2019-09-30 17:17SandrahuguetAssigned Tomarkmm82 => platform
2019-10-01 10:01AugustoMauchNote Added: 0114870
2019-10-01 10:01AugustoMauchAssigned Toplatform => francisco
2019-10-01 10:01AugustoMauchStatusnew => feedback
2019-10-01 10:22franciscoNote Added: 0114871
2019-10-01 10:22franciscoSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=19418#r19418
2019-10-01 10:47AugustoMauchSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=19419#r19419
2019-10-01 10:47AugustoMauchAssigned Tofrancisco => AugustoMauch
2019-10-01 10:47AugustoMauchStatusfeedback => scheduled
2019-10-01 10:50franciscoNote Added: 0114872
2019-10-01 11:47AugustoMauchReview Assigned To => Sandrahuguet
2019-10-01 11:54hgbotCheckin
2019-10-01 11:54hgbotNote Added: 0114873
2019-10-01 11:54hgbotStatusscheduled => resolved
2019-10-01 11:54hgbotResolutionopen => fixed
2019-10-01 11:54hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/4c75a4b806b563a36125cf649a9105b5a1d8b571 [^]
2019-10-01 17:57SandrahuguetNote Added: 0114880
2019-10-01 17:57SandrahuguetStatusresolved => closed
2019-10-01 17:57SandrahuguetFixed in Version => 3.0PR20Q2
2019-12-12 23:00hudsonbotCheckin
2019-12-12 23:00hudsonbotNote Added: 0116230
2022-02-07 09:24alostaleRelationship addedhas duplicate 0048166

Notes
(0114870)
AugustoMauch   
2019-10-01 10:01   
Cannot reproduce issue, when clicking the Manage Variants button the resulting grid appears empty
(0114871)
francisco   
2019-10-01 10:22   
Please see attached video with the steps to replicate the issue
(0114872)
francisco   
2019-10-01 10:50   
https://drive.google.com/open?id=1SYqk9TwzYFl3jU0YPOYIdHit1DeHsJYK [^]
(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
---
(0114880)
Sandrahuguet   
2019-10-01 17:57   
code review + testing ok
(0116230)
hudsonbot   
2019-12-12 23:00   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/954d2b7a66fb [^]
Maturity status: Test