Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0028187Openbravo ERPA. Platformpublic2014-11-17 13:352014-12-30 23:26
caristu 
AugustoMauch 
urgentmajoralways
closedfixed 
5
pi 
3.0PR15Q13.0PR15Q1 
alostale
Core
No
0028187: Error after saving a product with characteristics in grid view under some circunstances
Is not possible to modify a product with characteristics in grid view if the "Characteristic Description" field is not displayed in grid view.

It seems that the system is trying to save a JSON Object instead of a String, according to the error in the log:

 ERROR org.openbravo.base.validation.ValidationException - Exception
org.openbravo.base.validation.ValidationException:
    at org.openbravo.base.model.domaintype.BasePrimitiveDomainType.checkIsValidValue(BasePrimitiveDomainType.java:58)
    at org.openbravo.base.model.Property.checkIsValidValue(Property.java:804)
    at org.openbravo.base.structure.BaseOBObject.set(BaseOBObject.java:272)
1) Create a new product with one characteristic at least
2) Hide the "Characteristic Description" field of the grid view
3) Edit the product created in step 1), in grid view. For example, uncheck the "Active" checbox. Save the record, the error is thrown.
No tags attached.
Issue History
2014-11-17 13:35caristuNew Issue
2014-11-17 13:35caristuAssigned To => AugustoMauch
2014-11-17 13:35caristuModules => Core
2014-11-17 13:35caristuResolution time => 1418943600
2014-11-17 13:35caristuTriggers an Emergency Pack => No
2014-11-17 16:12heccamIssue Monitored: heccam
2014-11-26 08:22alostaleAssigned ToAugustoMauch => inigosanchez
2014-11-27 10:22AugustoMauchAssigned Toinigosanchez => AugustoMauch
2014-11-27 11:37AugustoMauchIssue Monitored: alostale
2014-11-27 11:37AugustoMauchReview Assigned To => alostale
2014-11-27 11:40hgbotCheckin
2014-11-27 11:40hgbotNote Added: 0072059
2014-11-27 11:40hgbotStatusnew => resolved
2014-11-27 11:40hgbotResolutionopen => fixed
2014-11-27 11:40hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/92f8c399eacbe8cfde48797fdf92a878e020f047 [^]
2014-12-01 13:51alostaleNote Added: 0072195
2014-12-01 13:51alostaleStatusresolved => closed
2014-12-01 13:51alostaleFixed in Version => 3.0PR15Q1
2014-12-30 23:26hudsonbotCheckin
2014-12-30 23:26hudsonbotNote Added: 0073150

Notes
(0072059)
hgbot   
2014-11-27 11:40   
Repository: erp/devel/pi
Changeset: 92f8c399eacbe8cfde48797fdf92a878e020f047
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Thu Nov 27 11:18:38 2014 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/92f8c399eacbe8cfde48797fdf92a878e020f047 [^]

Fixes issue 28187: Row is saved even with ProductCharacteristics column hidden

Product characteristics are somewhat special in the sense that the value returned by the FIC in columnValues is different from the value that is finally stored in the database. If a product has a characteristic 'X' with a value 'Y', the FIC returns this json object:
{ characteristics: { X:'Y'},
  dbValue: 'X : Y'
}

In the database the stored value should be the dbValue of this json object. This replacement is done in th setValue function of the product characteristics formitem. The problem is that this function is not invoked, and cannot be invoked, if this column is hidden in the grid. When the function is invoked, instead of storing string contained in the dbValue property in the database, the whole json object returned by the FIC is sent to the datasource and a validation exception is thrown. To fix this, the value is going to be fixed in the JsonToDataConverter.convertJsonToPropertyValue method. To be able to discern that the property belong to a Product Characteristics column, the ProductCharacteristicsDomainType class has been created and has been associated with the Product Characteristics reference. This class has a method called fixValue, that detects the case when the provided value is not correct, and fix it.

---
M modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonToDataConverter.java
M src-db/database/sourcedata/AD_REFERENCE.xml
A src/org/openbravo/base/model/domaintype/ProductCharacteristicsDomainType.java
---
(0072195)
alostale   
2014-12-01 13:51   
code reviewed

Tested showing and hiding the characteristics field and editing in grid and form views.
(0073150)
hudsonbot   
2014-12-30 23:26   
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/6525fe229e06 [^]
Maturity status: Test