From 3e64dc67371add198520663a78425fec6c921d42 Mon Sep 17 00:00:00 2001
From: igorpojzl <59439434+igorpojzl@users.noreply.github.com>
Date: Fri, 4 Jun 2021 10:03:05 +0200
Subject: [PATCH] IDEMPIERE-4479 - Allow define columnSql in AD_Field (#710)
* IDEMPIERE-4479 - Allow define columnSql in AD_Field
* IDEMPIERE-4479 Added View Update, ColumnSql fix FieldLength
* IDEMPIERE-4479 Updated AD_Field Model
* IDEMPIERE-4479 MFIeld update model logic
* IDEMPIERE-4479 Move Migration scripts to 8.2
---
db/ddlutils/oracle/views/AD_FIELD_V.sql | 2 +-
db/ddlutils/oracle/views/AD_FIELD_VT.sql | 2 +-
db/ddlutils/postgresql/views/AD_FIELD_V.sql | 2 +-
db/ddlutils/postgresql/views/AD_FIELD_VT.sql | 2 +-
.../oracle/202106031340_IDEMPIERE-4479.sql | 254 ++++++++++++++++++
.../202106031340_IDEMPIERE-4479.sql | 249 +++++++++++++++++
.../src/org/compiere/model/I_AD_Field.java | 39 ++-
.../src/org/compiere/model/MField.java | 7 -
.../src/org/compiere/model/X_AD_Field.java | 65 +++--
9 files changed, 574 insertions(+), 48 deletions(-)
create mode 100644 migration/i8.2/oracle/202106031340_IDEMPIERE-4479.sql
create mode 100644 migration/i8.2/postgresql/202106031340_IDEMPIERE-4479.sql
diff --git a/db/ddlutils/oracle/views/AD_FIELD_V.sql b/db/ddlutils/oracle/views/AD_FIELD_V.sql
index 4b8541d936..cfa8d03844 100644
--- a/db/ddlutils/oracle/views/AD_FIELD_V.sql
+++ b/db/ddlutils/oracle/views/AD_FIELD_V.sql
@@ -1,5 +1,5 @@
CREATE OR REPLACE VIEW ad_field_v AS
- SELECT t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, f.name, f.description, f.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline, f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, c.fieldlength, COALESCE(f.VFormat, c.VFormat) AS VFormat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue, c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable, c.isalwaysupdateable) AS isalwaysupdateable, COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable, c.isencrypted AS isencryptedcolumn, COALESCE(f.isselectioncolumn, c.isselectioncolumn) AS isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fg.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype, fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid, f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus, c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id, COALESCE(f.placeholder, c.placeholder) AS placeholder, c.ishtml, f.isquickform, COALESCE(f.ad_val_rule_Lookup_id, c.ad_val_rule_Lookup_id) AS ad_val_rule_Lookup_id, vrf.code AS validationcodeLookup
+ SELECT t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, f.name, f.description, f.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline, f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, COALESCE(f.columnsql, c.columnsql) AS columnsql, c.fieldlength, COALESCE(f.VFormat, c.VFormat) AS VFormat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue, c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable, c.isalwaysupdateable) AS isalwaysupdateable, COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable, c.isencrypted AS isencryptedcolumn, COALESCE(f.isselectioncolumn, c.isselectioncolumn) AS isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fg.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype, fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid, f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus, c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id, COALESCE(f.placeholder, c.placeholder) AS placeholder, c.ishtml, f.isquickform, COALESCE(f.ad_val_rule_Lookup_id, c.ad_val_rule_Lookup_id) AS ad_val_rule_Lookup_id, vrf.code AS validationcodeLookup
FROM ad_field f
JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id
diff --git a/db/ddlutils/oracle/views/AD_FIELD_VT.sql b/db/ddlutils/oracle/views/AD_FIELD_VT.sql
index 27b62c67d8..a105b19860 100644
--- a/db/ddlutils/oracle/views/AD_FIELD_VT.sql
+++ b/db/ddlutils/oracle/views/AD_FIELD_VT.sql
@@ -1,5 +1,5 @@
CREATE OR REPLACE VIEW ad_field_vt AS
- SELECT trl.ad_language, t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, trl.name, trl.description, trl.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline, f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, c.fieldlength, COALESCE(f.VFormat, c.VFormat) AS VFormat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue, c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable, c.isalwaysupdateable) AS isalwaysupdateable, COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable, c.isencrypted AS isencryptedcolumn, COALESCE(f.isselectioncolumn, c.isselectioncolumn) AS isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fgt.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype, fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid, f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus, c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id, COALESCE(trl.placeholder, ct.placeholder) AS placeholder, c.ishtml, f.isquickform, COALESCE(f.ad_val_rule_Lookup_id, c.ad_val_rule_Lookup_id) AS ad_val_rule_Lookup_id, vrf.code AS validationcodeLookup
+ SELECT trl.ad_language, t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, trl.name, trl.description, trl.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline, f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, COALESCE(f.columnsql, c.columnsql) AS columnsql, c.fieldlength, COALESCE(f.VFormat, c.VFormat) AS VFormat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue, c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable, c.isalwaysupdateable) AS isalwaysupdateable, COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable, c.isencrypted AS isencryptedcolumn, COALESCE(f.isselectioncolumn, c.isselectioncolumn) AS isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fgt.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype, fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid, f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus, c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id, COALESCE(trl.placeholder, ct.placeholder) AS placeholder, c.ishtml, f.isquickform, COALESCE(f.ad_val_rule_Lookup_id, c.ad_val_rule_Lookup_id) AS ad_val_rule_Lookup_id, vrf.code AS validationcodeLookup
FROM ad_field f
JOIN ad_field_trl trl ON f.ad_field_id = trl.ad_field_id
JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
diff --git a/db/ddlutils/postgresql/views/AD_FIELD_V.sql b/db/ddlutils/postgresql/views/AD_FIELD_V.sql
index fcabff31fd..7b12e95a9e 100644
--- a/db/ddlutils/postgresql/views/AD_FIELD_V.sql
+++ b/db/ddlutils/postgresql/views/AD_FIELD_V.sql
@@ -1,6 +1,6 @@
CREATE OR REPLACE VIEW ad_field_v AS
SELECT t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, f.name, f.description, f.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline,
-f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, c.fieldlength, COALESCE(f.VFormat, c.VFormat) AS VFormat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue,
+f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, COALESCE(f.columnsql, c.columnsql) AS columnsql, c.fieldlength, COALESCE(f.VFormat, c.VFormat) AS VFormat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue,
c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id,
c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable, c.isalwaysupdateable) AS isalwaysupdateable,
COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable,
diff --git a/db/ddlutils/postgresql/views/AD_FIELD_VT.sql b/db/ddlutils/postgresql/views/AD_FIELD_VT.sql
index 5ae487f2f5..77bd5e02dc 100644
--- a/db/ddlutils/postgresql/views/AD_FIELD_VT.sql
+++ b/db/ddlutils/postgresql/views/AD_FIELD_VT.sql
@@ -1,6 +1,6 @@
CREATE OR REPLACE VIEW ad_field_vt AS
SELECT trl.ad_language, t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, trl.name, trl.description, trl.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno,
- f.sortno, f.issameline, f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, c.fieldlength, COALESCE(f.VFormat, c.VFormat) AS VFormat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue,
+ f.sortno, f.issameline, f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, COALESCE(f.columnsql, c.columnsql) AS columnsql, c.fieldlength, COALESCE(f.VFormat, c.VFormat) AS VFormat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue,
c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id,
c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable,
c.isalwaysupdateable) AS isalwaysupdateable, COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable,
diff --git a/migration/i8.2/oracle/202106031340_IDEMPIERE-4479.sql b/migration/i8.2/oracle/202106031340_IDEMPIERE-4479.sql
new file mode 100644
index 0000000000..ec5bcd0be7
--- /dev/null
+++ b/migration/i8.2/oracle/202106031340_IDEMPIERE-4479.sql
@@ -0,0 +1,254 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-4479
+-- Jun 3, 2021, 1:36:39 PM CEST
+INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,IsHtml) VALUES (214499,0,'Column SQL','Virtual Column (r/o)','You can define virtual columns (not stored in the database). If defined, the Column name is the synonym of the SQL expression defined here. The SQL expression must be valid.
+Example: "Updated-Created" would list the age of the entry in days',107,'ColumnSQL',255,'N','N','N','N','N',0,'N',10,0,0,'Y',TO_DATE('2021-06-03 13:36:38','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-06-03 13:36:38','YYYY-MM-DD HH24:MI:SS'),100,2699,'Y','N','D','N','N','N','Y','5726e9db-774b-4257-956e-ae067fb23f33','Y',0,'N','N','N')
+;
+
+-- Jun 3, 2021, 1:36:42 PM CEST
+ALTER TABLE AD_Field ADD ColumnSQL VARCHAR2(255 CHAR) DEFAULT NULL
+;
+
+-- Jun 3, 2021, 1:37:45 PM CEST
+INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (206665,'Column SQL','Virtual Column (r/o)','You can define virtual columns (not stored in the database). If defined, the Column name is the synonym of the SQL expression defined here. The SQL expression must be valid.
+Example: "Updated-Created" would list the age of the entry in days',107,214499,'Y',255,500,'N','N','N','N',0,0,'Y',TO_DATE('2021-06-03 13:37:44','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-06-03 13:37:44','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','f2dc4a54-a4c2-4be4-83b4-0134783c12cd','Y',490,5)
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=924
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=133
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=390, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200838
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=400, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200834
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=410, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=13424
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=420, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62468
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=440, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=2, IsToolbarButton=NULL,Updated=TO_DATE('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206665
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=450, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53280
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=460, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203500
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=470, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200836
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=480, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200835
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=490, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=136
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=500, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=139
+;
+
+-- Jun 3, 2021, 3:42:52 PM CEST
+UPDATE AD_Column SET FieldLength=4000,Updated=TO_DATE('2021-06-03 15:42:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=214499
+;
+
+-- Jun 3, 2021, 3:42:57 PM CEST
+ALTER TABLE AD_Field MODIFY ColumnSQL VARCHAR2(4000 CHAR) DEFAULT NULL
+;
+
+CREATE OR REPLACE VIEW ad_field_v
+AS
+SELECT t.ad_window_id,
+ f.ad_tab_id,
+ f.ad_field_id,
+ tbl.ad_table_id,
+ f.ad_column_id,
+ f.name,
+ f.description,
+ f.help,
+ f.isdisplayed,
+ f.displaylogic,
+ f.displaylength,
+ f.seqno,
+ f.sortno,
+ f.issameline,
+ f.isheading,
+ f.isfieldonly,
+ f.isreadonly,
+ f.isencrypted AS isencryptedfield,
+ f.obscuretype,
+ c.columnname,
+ COALESCE(f.columnsql,c.columnsql) AS columnsql,
+ c.fieldlength,
+ COALESCE(f.VFormat,c.VFormat) AS VFormat,
+ COALESCE(f.defaultvalue,c.defaultvalue) AS defaultvalue,
+ c.iskey,
+ c.isparent,
+ COALESCE(f.ismandatory,c.ismandatory) AS ismandatory,
+ c.isidentifier,
+ c.istranslated,
+ COALESCE(f.ad_reference_value_id,c.ad_reference_value_id) AS ad_reference_value_id,
+ c.callout,
+ COALESCE(f.ad_reference_id,c.ad_reference_id) AS ad_reference_id,
+ COALESCE(f.ad_val_rule_id,c.ad_val_rule_id) AS ad_val_rule_id,
+ c.ad_process_id,
+ COALESCE(f.isalwaysupdateable,c.isalwaysupdateable) AS isalwaysupdateable,
+ COALESCE(f.readonlylogic,c.readonlylogic) AS readonlylogic,
+ COALESCE(f.mandatorylogic,c.mandatorylogic) AS mandatorylogic,
+ COALESCE(f.isupdateable,c.isupdateable) AS isupdateable,
+ c.isencrypted AS isencryptedcolumn,
+ COALESCE(f.isselectioncolumn,c.isselectioncolumn) AS isselectioncolumn,
+ tbl.tablename,
+ c.valuemin,
+ c.valuemax,
+ fg.name AS fieldgroup,
+ vr.code AS validationcode,
+ f.included_tab_id,
+ fg.fieldgrouptype,
+ fg.iscollapsedbydefault,
+ COALESCE(f.infofactoryclass,c.infofactoryclass) AS infofactoryclass,
+ c.isautocomplete,
+ COALESCE(f.isallowcopy,c.isallowcopy) AS isallowcopy,
+ f.isdisplayedgrid,
+ f.seqnogrid,
+ c.seqnoselection,
+ f.xposition,
+ f.columnspan,
+ f.numlines,
+ COALESCE(f.istoolbarbutton,c.istoolbarbutton) AS istoolbarbutton,
+ c.formatpattern,
+ f.isadvancedfield,
+ f.isdefaultfocus,
+ c.ad_chart_id,
+ f.ad_labelstyle_id,
+ f.ad_fieldstyle_id,
+ c.pa_dashboardcontent_id,
+ COALESCE(f.placeholder,c.placeholder) AS placeholder,
+ c.ishtml,
+ f.isquickform,
+ COALESCE(f.ad_val_rule_Lookup_id,c.ad_val_rule_Lookup_id) AS ad_val_rule_Lookup_id,
+ vrf.code AS validationcodeLookup
+FROM ad_field f
+ JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
+ LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id
+ LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id
+ JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id
+ LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE (f.ad_val_rule_id,c.ad_val_rule_id)
+ LEFT JOIN ad_val_rule vrf ON vrf.ad_val_rule_id = COALESCE (f.ad_val_rule_Lookup_id,c.ad_val_rule_Lookup_id)
+WHERE f.isactive = 'Y'
+AND c.isactive = 'Y';
+
+
+CREATE OR REPLACE VIEW ad_field_vt
+AS
+SELECT trl.ad_language,
+ t.ad_window_id,
+ f.ad_tab_id,
+ f.ad_field_id,
+ tbl.ad_table_id,
+ f.ad_column_id,
+ trl.name,
+ trl.description,
+ trl.help,
+ f.isdisplayed,
+ f.displaylogic,
+ f.displaylength,
+ f.seqno,
+ f.sortno,
+ f.issameline,
+ f.isheading,
+ f.isfieldonly,
+ f.isreadonly,
+ f.isencrypted AS isencryptedfield,
+ f.obscuretype,
+ c.columnname,
+ COALESCE(f.columnsql,c.columnsql) AS columnsql,
+ c.fieldlength,
+ COALESCE(f.VFormat,c.VFormat) AS VFormat,
+ COALESCE(f.defaultvalue,c.defaultvalue) AS defaultvalue,
+ c.iskey,
+ c.isparent,
+ COALESCE(f.ismandatory,c.ismandatory) AS ismandatory,
+ c.isidentifier,
+ c.istranslated,
+ COALESCE(f.ad_reference_value_id,c.ad_reference_value_id) AS ad_reference_value_id,
+ c.callout,
+ COALESCE(f.ad_reference_id,c.ad_reference_id) AS ad_reference_id,
+ COALESCE(f.ad_val_rule_id,c.ad_val_rule_id) AS ad_val_rule_id,
+ c.ad_process_id,
+ COALESCE(f.isalwaysupdateable,c.isalwaysupdateable) AS isalwaysupdateable,
+ COALESCE(f.readonlylogic,c.readonlylogic) AS readonlylogic,
+ COALESCE(f.mandatorylogic,c.mandatorylogic) AS mandatorylogic,
+ COALESCE(f.isupdateable,c.isupdateable) AS isupdateable,
+ c.isencrypted AS isencryptedcolumn,
+ COALESCE(f.isselectioncolumn,c.isselectioncolumn) AS isselectioncolumn,
+ tbl.tablename,
+ c.valuemin,
+ c.valuemax,
+ fgt.name AS fieldgroup,
+ vr.code AS validationcode,
+ f.included_tab_id,
+ fg.fieldgrouptype,
+ fg.iscollapsedbydefault,
+ COALESCE(f.infofactoryclass,c.infofactoryclass) AS infofactoryclass,
+ c.isautocomplete,
+ COALESCE(f.isallowcopy,c.isallowcopy) AS isallowcopy,
+ f.isdisplayedgrid,
+ f.seqnogrid,
+ c.seqnoselection,
+ f.xposition,
+ f.columnspan,
+ f.numlines,
+ COALESCE(f.istoolbarbutton,c.istoolbarbutton) AS istoolbarbutton,
+ c.formatpattern,
+ f.isadvancedfield,
+ f.isdefaultfocus,
+ c.ad_chart_id,
+ f.ad_labelstyle_id,
+ f.ad_fieldstyle_id,
+ c.pa_dashboardcontent_id,
+ COALESCE(trl.placeholder,ct.placeholder) AS placeholder,
+ c.ishtml,
+ f.isquickform,
+ COALESCE(f.ad_val_rule_Lookup_id,c.ad_val_rule_Lookup_id) AS ad_val_rule_Lookup_id,
+ vrf.code AS validationcodeLookup
+FROM ad_field f
+ JOIN ad_field_trl trl ON f.ad_field_id = trl.ad_field_id
+ JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
+ LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id
+ LEFT JOIN ad_fieldgroup_trl fgt
+ ON f.ad_fieldgroup_id = fgt.ad_fieldgroup_id
+ AND trl.ad_language = fgt.ad_language
+ LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id
+ LEFT JOIN ad_column_trl ct
+ ON f.ad_column_id = ct.ad_column_id
+ AND trl.ad_language = ct.ad_language
+ JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id
+ LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE (f.ad_val_rule_id,c.ad_val_rule_id)
+ LEFT JOIN ad_val_rule vrf ON vrf.ad_val_rule_id = COALESCE (f.ad_val_rule_Lookup_id,c.ad_val_rule_Lookup_id)
+WHERE f.isactive = 'Y'
+AND c.isactive = 'Y';
+
+
+SELECT Register_Migration_Script ('202106031340_IDEMPIERE-4479.sql') FROM DUAL
+;
diff --git a/migration/i8.2/postgresql/202106031340_IDEMPIERE-4479.sql b/migration/i8.2/postgresql/202106031340_IDEMPIERE-4479.sql
new file mode 100644
index 0000000000..33d386a2f1
--- /dev/null
+++ b/migration/i8.2/postgresql/202106031340_IDEMPIERE-4479.sql
@@ -0,0 +1,249 @@
+-- IDEMPIERE-4479
+-- Jun 3, 2021, 1:36:39 PM CEST
+INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,IsHtml) VALUES (214499,0,'Column SQL','Virtual Column (r/o)','You can define virtual columns (not stored in the database). If defined, the Column name is the synonym of the SQL expression defined here. The SQL expression must be valid.
+Example: "Updated-Created" would list the age of the entry in days',107,'ColumnSQL',255,'N','N','N','N','N',0,'N',10,0,0,'Y',TO_TIMESTAMP('2021-06-03 13:36:38','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-06-03 13:36:38','YYYY-MM-DD HH24:MI:SS'),100,2699,'Y','N','D','N','N','N','Y','5726e9db-774b-4257-956e-ae067fb23f33','Y',0,'N','N','N')
+;
+
+-- Jun 3, 2021, 1:36:42 PM CEST
+ALTER TABLE AD_Field ADD COLUMN ColumnSQL VARCHAR(255) DEFAULT NULL
+;
+
+-- Jun 3, 2021, 1:37:45 PM CEST
+INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (206665,'Column SQL','Virtual Column (r/o)','You can define virtual columns (not stored in the database). If defined, the Column name is the synonym of the SQL expression defined here. The SQL expression must be valid.
+Example: "Updated-Created" would list the age of the entry in days',107,214499,'Y',255,500,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2021-06-03 13:37:44','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-06-03 13:37:44','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','f2dc4a54-a4c2-4be4-83b4-0134783c12cd','Y',490,5)
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=924
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=133
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=390, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200838
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=400, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200834
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=410, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=13424
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=420, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62468
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=440, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=2, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206665
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=450, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53280
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=460, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203500
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=470, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200836
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=480, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200835
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=490, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=136
+;
+
+-- Jun 3, 2021, 1:40:24 PM CEST
+UPDATE AD_Field SET SeqNo=500, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-06-03 13:40:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=139
+;
+
+-- Jun 3, 2021, 3:42:52 PM CEST
+UPDATE AD_Column SET FieldLength=4000,Updated=TO_TIMESTAMP('2021-06-03 15:42:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=214499
+;
+
+-- Jun 3, 2021, 3:42:57 PM CEST
+INSERT INTO t_alter_column values('ad_field','ColumnSQL','VARCHAR(4000)',null,'NULL')
+;
+
+CREATE OR REPLACE VIEW ad_field_v
+AS
+SELECT t.ad_window_id,
+ f.ad_tab_id,
+ f.ad_field_id,
+ tbl.ad_table_id,
+ f.ad_column_id,
+ f.name,
+ f.description,
+ f.help,
+ f.isdisplayed,
+ f.displaylogic,
+ f.displaylength,
+ f.seqno,
+ f.sortno,
+ f.issameline,
+ f.isheading,
+ f.isfieldonly,
+ f.isreadonly,
+ f.isencrypted AS isencryptedfield,
+ f.obscuretype,
+ c.columnname,
+ COALESCE(f.columnsql,c.columnsql) AS columnsql,
+ c.fieldlength,
+ COALESCE(f.VFormat,c.VFormat) AS VFormat,
+ COALESCE(f.defaultvalue,c.defaultvalue) AS defaultvalue,
+ c.iskey,
+ c.isparent,
+ COALESCE(f.ismandatory,c.ismandatory) AS ismandatory,
+ c.isidentifier,
+ c.istranslated,
+ COALESCE(f.ad_reference_value_id,c.ad_reference_value_id) AS ad_reference_value_id,
+ c.callout,
+ COALESCE(f.ad_reference_id,c.ad_reference_id) AS ad_reference_id,
+ COALESCE(f.ad_val_rule_id,c.ad_val_rule_id) AS ad_val_rule_id,
+ c.ad_process_id,
+ COALESCE(f.isalwaysupdateable,c.isalwaysupdateable) AS isalwaysupdateable,
+ COALESCE(f.readonlylogic,c.readonlylogic) AS readonlylogic,
+ COALESCE(f.mandatorylogic,c.mandatorylogic) AS mandatorylogic,
+ COALESCE(f.isupdateable,c.isupdateable) AS isupdateable,
+ c.isencrypted AS isencryptedcolumn,
+ COALESCE(f.isselectioncolumn,c.isselectioncolumn) AS isselectioncolumn,
+ tbl.tablename,
+ c.valuemin,
+ c.valuemax,
+ fg.name AS fieldgroup,
+ vr.code AS validationcode,
+ f.included_tab_id,
+ fg.fieldgrouptype,
+ fg.iscollapsedbydefault,
+ COALESCE(f.infofactoryclass,c.infofactoryclass) AS infofactoryclass,
+ c.isautocomplete,
+ COALESCE(f.isallowcopy,c.isallowcopy) AS isallowcopy,
+ f.isdisplayedgrid,
+ f.seqnogrid,
+ c.seqnoselection,
+ f.xposition,
+ f.columnspan,
+ f.numlines,
+ COALESCE(f.istoolbarbutton,c.istoolbarbutton) AS istoolbarbutton,
+ c.formatpattern,
+ f.isadvancedfield,
+ f.isdefaultfocus,
+ c.ad_chart_id,
+ f.ad_labelstyle_id,
+ f.ad_fieldstyle_id,
+ c.pa_dashboardcontent_id,
+ COALESCE(f.placeholder,c.placeholder) AS placeholder,
+ c.ishtml,
+ f.isquickform,
+ COALESCE(f.ad_val_rule_Lookup_id,c.ad_val_rule_Lookup_id) AS ad_val_rule_Lookup_id,
+ vrf.code AS validationcodeLookup
+FROM ad_field f
+ JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
+ LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id
+ LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id
+ JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id
+ LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE (f.ad_val_rule_id,c.ad_val_rule_id)
+ LEFT JOIN ad_val_rule vrf ON vrf.ad_val_rule_id = COALESCE (f.ad_val_rule_Lookup_id,c.ad_val_rule_Lookup_id)
+WHERE f.isactive = 'Y'
+AND c.isactive = 'Y';
+
+
+CREATE OR REPLACE VIEW ad_field_vt
+AS
+SELECT trl.ad_language, t.ad_window_id,
+ f.ad_tab_id,f.ad_field_id,
+ tbl.ad_table_id,
+ f.ad_column_id,
+ trl.name,
+ trl.description,
+ trl.help,
+ f.isdisplayed,
+ f.displaylogic,
+ f.displaylength,
+ f.seqno,
+ f.sortno,
+ f.issameline,
+ f.isheading,
+ f.isfieldonly,
+ f.isreadonly,
+ f.isencrypted AS isencryptedfield,
+ f.obscuretype,
+ c.columnname,
+ COALESCE(f.columnsql,c.columnsql) AS columnsql,
+ c.fieldlength,
+ COALESCE(f.VFormat,c.VFormat) AS VFormat,
+ COALESCE(f.defaultvalue,c.defaultvalue) AS defaultvalue,
+ c.iskey,
+ c.isparent,
+ COALESCE(f.ismandatory,c.ismandatory) AS ismandatory,
+ c.isidentifier,
+ c.istranslated,
+ COALESCE(f.ad_reference_value_id,c.ad_reference_value_id) AS ad_reference_value_id,
+ c.callout,
+ COALESCE(f.ad_reference_id,c.ad_reference_id) AS ad_reference_id,
+ COALESCE(f.ad_val_rule_id,c.ad_val_rule_id) AS ad_val_rule_id,
+ c.ad_process_id,
+ COALESCE(f.isalwaysupdateable,c.isalwaysupdateable) AS isalwaysupdateable,
+ COALESCE(f.readonlylogic,c.readonlylogic) AS readonlylogic,
+ COALESCE(f.mandatorylogic,c.mandatorylogic) AS mandatorylogic,
+ COALESCE(f.isupdateable,c.isupdateable) AS isupdateable,
+ c.isencrypted AS isencryptedcolumn,
+ COALESCE(f.isselectioncolumn,c.isselectioncolumn) AS isselectioncolumn,
+ tbl.tablename,
+ c.valuemin,
+ c.valuemax,
+ fgt.name AS fieldgroup,
+ vr.code AS validationcode,
+ f.included_tab_id,
+ fg.fieldgrouptype,
+ fg.iscollapsedbydefault,
+ COALESCE(f.infofactoryclass,c.infofactoryclass) AS infofactoryclass,
+ c.isautocomplete,
+ COALESCE(f.isallowcopy,c.isallowcopy) AS isallowcopy,
+ f.isdisplayedgrid,
+ f.seqnogrid,
+ c.seqnoselection,
+ f.xposition,
+ f.columnspan,
+ f.numlines,
+ COALESCE(f.istoolbarbutton,c.istoolbarbutton) AS istoolbarbutton,
+ c.formatpattern,
+ f.isadvancedfield,
+ f.isdefaultfocus,
+ c.ad_chart_id,
+ f.ad_labelstyle_id,
+ f.ad_fieldstyle_id,
+ c.pa_dashboardcontent_id,
+ COALESCE(trl.placeholder,ct.placeholder) AS placeholder,
+ c.ishtml,
+ f.isquickform,
+ COALESCE(f.ad_val_rule_Lookup_id,c.ad_val_rule_Lookup_id) AS ad_val_rule_Lookup_id,
+ vrf.code AS validationcodeLookup
+FROM ad_field f
+ JOIN ad_field_trl trl ON f.ad_field_id = trl.ad_field_id
+ JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
+ LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id
+ LEFT JOIN ad_fieldgroup_trl fgt
+ ON f.ad_fieldgroup_id = fgt.ad_fieldgroup_id
+ AND trl.ad_language::TEXT = fgt.ad_language::TEXT
+ LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id
+ LEFT JOIN ad_column_trl ct
+ ON f.ad_column_id = ct.ad_column_id
+ AND trl.ad_language::TEXT = ct.ad_language::TEXT
+ JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id
+ LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE (f.ad_val_rule_id,c.ad_val_rule_id)
+ LEFT JOIN ad_val_rule vrf ON vrf.ad_val_rule_id = COALESCE (f.ad_val_rule_Lookup_id,c.ad_val_rule_Lookup_id)
+WHERE f.isactive = 'Y'
+AND c.isactive = 'Y';
+
+
+SELECT Register_Migration_Script ('202106031340_IDEMPIERE-4479.sql') FROM DUAL
+;
diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_Field.java b/org.adempiere.base/src/org/compiere/model/I_AD_Field.java
index 20a87a62c8..77bf76718d 100644
--- a/org.adempiere.base/src/org/compiere/model/I_AD_Field.java
+++ b/org.adempiere.base/src/org/compiere/model/I_AD_Field.java
@@ -79,19 +79,6 @@ public interface I_AD_Field
public org.compiere.model.I_AD_FieldGroup getAD_FieldGroup() throws RuntimeException;
- /** Column name AD_Field_ID */
- public static final String COLUMNNAME_AD_Field_ID = "AD_Field_ID";
-
- /** Set Field.
- * Field on a database table
- */
- public void setAD_Field_ID (int AD_Field_ID);
-
- /** Get Field.
- * Field on a database table
- */
- public int getAD_Field_ID();
-
/** Column name AD_FieldStyle_ID */
public static final String COLUMNNAME_AD_FieldStyle_ID = "AD_FieldStyle_ID";
@@ -107,6 +94,19 @@ public interface I_AD_Field
public org.compiere.model.I_AD_Style getAD_FieldStyle() throws RuntimeException;
+ /** Column name AD_Field_ID */
+ public static final String COLUMNNAME_AD_Field_ID = "AD_Field_ID";
+
+ /** Set Field.
+ * Field on a database table
+ */
+ public void setAD_Field_ID (int AD_Field_ID);
+
+ /** Get Field.
+ * Field on a database table
+ */
+ public int getAD_Field_ID();
+
/** Column name AD_Field_UU */
public static final String COLUMNNAME_AD_Field_UU = "AD_Field_UU";
@@ -219,6 +219,19 @@ public interface I_AD_Field
public org.compiere.model.I_AD_Val_Rule getAD_Val_Rule_Lookup() throws RuntimeException;
+ /** Column name ColumnSQL */
+ public static final String COLUMNNAME_ColumnSQL = "ColumnSQL";
+
+ /** Set Column SQL.
+ * Virtual Column (r/o)
+ */
+ public void setColumnSQL (String ColumnSQL);
+
+ /** Get Column SQL.
+ * Virtual Column (r/o)
+ */
+ public String getColumnSQL();
+
/** Column name ColumnSpan */
public static final String COLUMNNAME_ColumnSpan = "ColumnSpan";
diff --git a/org.adempiere.base/src/org/compiere/model/MField.java b/org.adempiere.base/src/org/compiere/model/MField.java
index ad783fe317..8ea2058da8 100644
--- a/org.adempiere.base/src/org/compiere/model/MField.java
+++ b/org.adempiere.base/src/org/compiere/model/MField.java
@@ -216,13 +216,6 @@ public class MField extends X_AD_Field implements ImmutablePOSupport
setAD_Val_Rule_ID(0);
setIsToolbarButton(null);
}
- if (isDisplayed()) {
- MColumn column = (MColumn) getAD_Column();
- if (column.isVirtualSearchColumn()) {
- setIsDisplayed(false);
- setIsDisplayedGrid(false);
- }
- }
return true;
} // beforeSave
diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_Field.java b/org.adempiere.base/src/org/compiere/model/X_AD_Field.java
index fe8a7ab2d0..7209621787 100644
--- a/org.adempiere.base/src/org/compiere/model/X_AD_Field.java
+++ b/org.adempiere.base/src/org/compiere/model/X_AD_Field.java
@@ -32,7 +32,7 @@ public class X_AD_Field extends PO implements I_AD_Field, I_Persistent
/**
*
*/
- private static final long serialVersionUID = 20201220L;
+ private static final long serialVersionUID = 20210604L;
/** Standard Constructor */
public X_AD_Field (Properties ctx, int AD_Field_ID, String trxName)
@@ -148,29 +148,6 @@ public class X_AD_Field extends PO implements I_AD_Field, I_Persistent
return ii.intValue();
}
- /** Set Field.
- @param AD_Field_ID
- Field on a database table
- */
- public void setAD_Field_ID (int AD_Field_ID)
- {
- if (AD_Field_ID < 1)
- set_ValueNoCheck (COLUMNNAME_AD_Field_ID, null);
- else
- set_ValueNoCheck (COLUMNNAME_AD_Field_ID, Integer.valueOf(AD_Field_ID));
- }
-
- /** Get Field.
- @return Field on a database table
- */
- public int getAD_Field_ID ()
- {
- Integer ii = (Integer)get_Value(COLUMNNAME_AD_Field_ID);
- if (ii == null)
- return 0;
- return ii.intValue();
- }
-
public org.compiere.model.I_AD_Style getAD_FieldStyle() throws RuntimeException
{
return (org.compiere.model.I_AD_Style)MTable.get(getCtx(), org.compiere.model.I_AD_Style.Table_Name)
@@ -199,6 +176,29 @@ public class X_AD_Field extends PO implements I_AD_Field, I_Persistent
return ii.intValue();
}
+ /** Set Field.
+ @param AD_Field_ID
+ Field on a database table
+ */
+ public void setAD_Field_ID (int AD_Field_ID)
+ {
+ if (AD_Field_ID < 1)
+ set_ValueNoCheck (COLUMNNAME_AD_Field_ID, null);
+ else
+ set_ValueNoCheck (COLUMNNAME_AD_Field_ID, Integer.valueOf(AD_Field_ID));
+ }
+
+ /** Get Field.
+ @return Field on a database table
+ */
+ public int getAD_Field_ID ()
+ {
+ Integer ii = (Integer)get_Value(COLUMNNAME_AD_Field_ID);
+ if (ii == null)
+ return 0;
+ return ii.intValue();
+ }
+
/** Set AD_Field_UU.
@param AD_Field_UU AD_Field_UU */
public void setAD_Field_UU (String AD_Field_UU)
@@ -381,6 +381,23 @@ public class X_AD_Field extends PO implements I_AD_Field, I_Persistent
return ii.intValue();
}
+ /** Set Column SQL.
+ @param ColumnSQL
+ Virtual Column (r/o)
+ */
+ public void setColumnSQL (String ColumnSQL)
+ {
+ set_Value (COLUMNNAME_ColumnSQL, ColumnSQL);
+ }
+
+ /** Get Column SQL.
+ @return Virtual Column (r/o)
+ */
+ public String getColumnSQL ()
+ {
+ return (String)get_Value(COLUMNNAME_ColumnSQL);
+ }
+
/** Set Column Span.
@param ColumnSpan
Number of column for a box of field