-- IDEMPIERE-4334 Fixed Assets wrong dictionary
-- Jun 13, 2020, 4:54:29 PM CEST
UPDATE AD_Table SET IsActive='N',Updated=TO_TIMESTAMP('2020-06-13 16:54:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=53126
;

-- Jun 13, 2020, 4:54:37 PM CEST
UPDATE AD_Tab SET IsActive='N',Updated=TO_TIMESTAMP('2020-06-13 16:54:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53170
;

-- Jun 13, 2020, 4:54:43 PM CEST
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2020-06-13 16:54:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=53057
;

-- Jun 13, 2020, 4:57:11 PM CEST
UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2020-06-13 16:57:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=55831
;

-- Jun 13, 2020, 4:59:22 PM CEST
UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2020-06-13 16:59:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=55635
;

-- Jun 13, 2020, 5:00:53 PM CEST
UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2020-06-13 17:00:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=55787
;

-- Jun 13, 2020, 5:04:41 PM CEST
UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2020-06-13 17:04:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=55998
;

-- Jun 13, 2020, 5:21:44 PM CEST
UPDATE AD_Field SET IsActive='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-06-13 17:21:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=55913
;

-- Jun 13, 2020, 5:23:24 PM CEST
UPDATE AD_Field SET IsActive='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-06-13 17:23:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=56063
;

-- Jun 13, 2020, 5:23:40 PM CEST
UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2020-06-13 17:23:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=55786
;

-- Jun 13, 2020, 5:23:44 PM CEST
UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2020-06-13 17:23:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=55832
;

-- Jun 13, 2020, 5:23:50 PM CEST
UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2020-06-13 17:23:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56004
;

-- Jun 13, 2020, 5:27:16 PM CEST
UPDATE AD_Field SET IsActive='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-06-13 17:27:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=56064
;

-- Jun 13, 2020, 5:27:29 PM CEST
UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2020-06-13 17:27:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=55782
;

-- Jun 13, 2020, 5:27:42 PM CEST
UPDATE AD_Field SET IsActive='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-06-13 17:27:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=55915
;

-- Jun 13, 2020, 5:27:51 PM CEST
UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2020-06-13 17:27:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=55873
;

-- Jun 13, 2020, 5:27:55 PM CEST
UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2020-06-13 17:27:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56061
;

-- Jun 13, 2020, 5:31:31 PM CEST
UPDATE AD_Field SET IsActive='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-06-13 17:31:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=56057
;

-- Jun 13, 2020, 5:31:39 PM CEST
UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2020-06-13 17:31:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=55779
;

-- Jun 13, 2020, 5:31:52 PM CEST
UPDATE AD_Field SET IsActive='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-06-13 17:31:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=55908
;

-- Jun 13, 2020, 5:31:59 PM CEST
UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2020-06-13 17:31:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=55857
;

-- Jun 13, 2020, 5:32:03 PM CEST
UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2020-06-13 17:32:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56064
;

UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2020-06-13 17:56:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID IN (
55604, /*A_Asset_Acct.A_Disposal_Gain */
55613, /*A_Asset_Acct.A_Disposal_Loss */
55612, /*A_Asset_Acct.A_Disposal_Revenue */
55609, /*A_Asset_Acct.A_Reval_Accumdep_Offset_Cur */
55608, /*A_Asset_Acct.A_Reval_Accumdep_Offset_Prior */
55606, /*A_Asset_Acct.A_Reval_Cost_Offset */
55605, /*A_Asset_Acct.A_Reval_Cost_Offset_Prior */
55624, /*A_Asset_Acct.A_Reval_Depexp_Offset */
55840, /*A_Asset_Change.A_Disposal_Loss */
55839, /*A_Asset_Change.A_Disposal_Revenue */
55783, /*A_Asset_Group_Acct.A_Disposal_Gain */
55762, /*A_Asset_Group_Acct.A_Disposal_Loss */
55771, /*A_Asset_Group_Acct.A_Disposal_Revenue */
55770, /*A_Asset_Group_Acct.A_Reval_Accumdep_Offset_Cur */
55769, /*A_Asset_Group_Acct.A_Reval_Accumdep_Offset_Prior */
55767, /*A_Asset_Group_Acct.A_Reval_Cost_Offset */
55766, /*A_Asset_Group_Acct.A_Reval_Cost_Offset_Prior */
55765, /*A_Asset_Group_Acct.A_Reval_Depexp_Offset */
55690, /*A_Asset_Transfer.A_Accumdepreciation_Acct_New */
55662, /*A_Asset_Transfer.A_Asset_Acct_New */
55687, /*A_Asset_Transfer.A_Depreciation_Acct_New */
55665, /*A_Asset_Transfer.A_Disposal_Loss_New */
55672, /*A_Asset_Transfer.A_Disposal_Revenue_New */
56009, /*I_Asset.A_Disposal_Loss */
56010, /*I_Asset.A_Disposal_Revenue */
56019, /*I_Asset.A_Reval_Accumdep_Offset_Cur */
56046, /*I_Asset.A_Reval_Accumdep_Offset_Prior */
56048, /*I_Asset.A_Reval_Cost_Offset */
56049, /*I_Asset.A_Reval_Cost_Offset_Prior */
56050  /*I_Asset.A_Reval_Depexp_Offset */
)
;

UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2020-06-13 17:56:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID IN (
55610,
55695,
55884,
55609,
55694,
55883,
55614,
55699,
55888,
55615,
55700,
55889,
55612,
55697,
55886,
55613,
55698,
55887,
55616,
55701,
55890,
55953,
55952,
59255,
56074,
56073,
56078,
56079,
56076,
56077,
56080,
55724,
59200,
55722,
59201,
55726,
59202,
55730,
59203,
55728,
59204
);

ALTER TABLE A_FundingMode_Acct ADD CONSTRAINT AFundingModevc_AFundingModeAcc FOREIGN KEY(A_FundingMode_Acct) REFERENCES C_ValidCombination(C_ValidCombination_ID) DEFERRABLE INITIALLY DEFERRED
;

ALTER TABLE a_asset_split ALTER COLUMN a_asset_id_to TYPE numeric(10,0) USING a_asset_id_to::numeric
;

ALTER TABLE A_Asset_Split ADD CONSTRAINT AAssetID_AAssetSplit FOREIGN KEY (A_Asset_ID_To) REFERENCES A_Asset DEFERRABLE INITIALLY DEFERRED
;

SELECT register_migration_script('202006131716_IDEMPIERE-4334.sql') FROM dual
;

