Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0019333Openbravo ERPA. Platformpublic2011-12-19 16:092012-01-31 12:42
jecharri 
AugustoMauch 
highminoralways
closedno change required 
5
pi 
3.0MP9 
Google Chrome
Core
No
0019333: Columns with reference time are not working perfectly
Columns with reference time are not working perfectly.

When you have one column with reference type "Time" and you try to put the default value from other column with reference type "time" it is imposible.
-Create two columns:
+First in the "c_invoice" table:em_ti_header timestamp without time zone
+The second in the "c_invoiceline" table:em_ti_lines timestamp without time zone

Import the columns and fields to Openbravo.

-After that, in window "Tables and Columns" select firs the "c_invoice" table and change the reference of the column "EM_Ti_Header" to Time. Do the same with the column "EM_Ti_Lines" in table "c_invoiceline".
-Apart from that, add to column "EM_Ti_Lines" the default value "@SQL=select em_ti_header from c_invoice where c_invoice_id =@C_Invoice_ID@"

-Finally do "ant smartbuild" and restart Tomcat.
-Now try to create a line. You will see the next error [error.txt]
No tags attached.
txt error.txt (12,468) 2011-12-19 16:09
https://issues.openbravo.com/file_download.php?file_id=4838&type=bug
Issue History
2011-12-19 16:09jecharriNew Issue
2011-12-19 16:09jecharriAssigned To => alostale
2011-12-19 16:09jecharriFile Added: error.txt
2011-12-19 16:09jecharriWeb browser => Google Chrome
2011-12-19 16:09jecharriModules => Core
2011-12-19 16:09jecharriResolution time => 1331506800
2012-01-25 09:45alostaleAssigned Toalostale => AugustoMauch
2012-01-31 12:42AugustoMauchNote Added: 0044735
2012-01-31 12:42AugustoMauchStatusnew => closed
2012-01-31 12:42AugustoMauchResolutionopen => no change required

Notes
(0044735)
AugustoMauch   
2012-01-31 12:42   
There was an error when creating a new line not because the software was faulty, but because the default value SQL statement was not correct.

The field initializer takes for granted that the default value is of the correct type (in this case, Time), but the default value SQL statement returns a Date.

In order to make it work, the default value should be changed from @SQL=select em_ti_header from c_invoice where c_invoice_id =@C_Invoice_ID@ to @SQL=select to_char(em_ti_header,'HH24:MI:SS') from c_invoice where c_invoice_id =@C_Invoice_ID@