Reference Color broken
Description
Environment
Attachments
Activity

Nicolas Micoud July 4, 2018 at 11:18 AM
Hi Carlos,
Can you please check the patch ?
For future reference for the migration script : the constaint fields on Table/Column should be hidden if DataType is Color
Thanks,
Nicolas

Nicolas Micoud July 4, 2018 at 10:59 AM
Not sure about deactivating the Color window. For instance, I'm using it to allow user to choose a color for trees.
But i can reactivate it later if needed, not a big deal.
An option could be to check the columname :
If it ends with _ID, it will work as now (foreign key).
In other case, it will create a varchar.
This way, both behaviour could coexist.
But doesn't sound easy as DisplayType only test the referenceID to say if isText, isID, ...
I will try localy to change the way column is created and if is ok, upload a patch.
See you
Nicolas
Carlos Ruiz July 4, 2018 at 10:51 AM
Hi ,
I think we can just keep the Color reference as it is. #1, #2 and #3 would not be necessary, from what I saw - the Color reference is working fine as a Color picker.
I have not reviewed code but I think is just to change the way as the column with Color reference is created.
I think when you create a column with name "Color" - is being created correctly as a varchar - but in code is intended to be a foreign key - so that would be the part to fix - it must not be a foreign key, just the varchar with the color code.
Also I think inactivating the Color window is necessary here - and check in code if there are some special references to "Color" type.
Regards,
Carlos Ruiz

Nicolas Micoud July 4, 2018 at 10:14 AM
Hi Carlos,
So, just to be sure :
#1: deactivate "Color" (ID = 27), based on AD_Color table.
#2: add a new data type "ColorPicker" (ID = 200xxx).
#3: update code to add ColorPicker (DefaultEditorFactory, DB_Oracle.getDataType, DisplayType) and save values as varchar
#4: add a new element "Color" and use it on the Test table.
Am I right ?
Carlos Ruiz July 4, 2018 at 9:49 AM
My suggestion to fix:
Deprecate the table AD_Color - the only references I see are from deprecated tables AD_Workbench and AD_Desktop
Implement the reference Color as a varchar in database - not as a foreign key
Implement the reference Color correctly as a color picker (it is working as that now) saving the value as a varchar - I think this is working correctly now, is just the creation of the column which is wrong
WDYT?
Details
Details
Assignee

Triggered by here:
https://groups.google.com/d/msg/idempiere/wHMJXWOwlPc/3k5SU6mlCQAJ
There is a potential fix there, but it seems the implementation of Color reference in core is broken.
In demo.globalqss.com I tried to create a new column with name Color and reference Color.
It could not be created because the type is varchar and it requires to be a foreign key to ad_color_id
So, I created the column Test.AD_Color_ID instead, with reference Color - and this worked "fine" on database, creating the column and the foreign key.
The field is displayed in Test window as a color picker, but it cannot be saved because it tries to save the Color code and the system expects and ID as a reference for the table AD_Color_ID.
Conclusion, Color reference is broken, not working at all.