diff --git a/migration/i8.2z/oracle/202111060700_IDEMPIERE-5031.sql b/migration/i8.2z/oracle/202111060700_IDEMPIERE-5031.sql new file mode 100644 index 0000000000..9a85674277 --- /dev/null +++ b/migration/i8.2z/oracle/202111060700_IDEMPIERE-5031.sql @@ -0,0 +1,435 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-5031 Implement auto produce upon shipment for mfg light +-- Nov 6, 2021, 11:00:18 AM MYT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,PrintName,EntityType,AD_Element_UU) VALUES (203548,0,0,'Y',TO_DATE('2021-11-06 11:00:17','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-11-06 11:00:17','YYYY-MM-DD HH24:MI:SS'),100,'IsAutoProduce','Auto Produce','Auto create production to fulfill shipment','Auto Produce','D','49d2748d-90c3-44d6-94e0-7cb5b9e98f29') +; + +-- Nov 6, 2021, 11:00:55 AM MYT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,AD_Table_ID,ColumnName,DefaultValue,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,FKConstraintType,IsHtml) VALUES (214618,0,'Auto Produce','Auto create production to fulfill shipment',208,'IsAutoProduce','N',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_DATE('2021-11-06 11:00:54','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-11-06 11:00:54','YYYY-MM-DD HH24:MI:SS'),100,203548,'Y','N','D','N','N','N','Y','0837aa88-8aff-4f8a-ad1e-cdb9089bb87c','Y',0,'N','N','N','N') +; + +-- Nov 6, 2021, 11:01:00 AM MYT +ALTER TABLE M_Product ADD IsAutoProduce CHAR(1) DEFAULT 'N' CHECK (IsAutoProduce IN ('Y','N')) NOT NULL +; + +-- Nov 6, 2021, 11:02:58 AM MYT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (206800,'Auto Produce','Auto create production to fulfill shipment',180,214618,'Y',0,610,0,'N','N','N','N',0,0,'Y',TO_DATE('2021-11-06 11:02:58','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-11-06 11:02:58','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','4626cd57-543b-4e69-8d3c-88800ac77396','Y',600,5,2,1,'N','N','N','N') +; + +-- Nov 6, 2021, 11:03:28 AM MYT +UPDATE AD_Field SET SeqNo=400,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=206800 +; + +-- Nov 6, 2021, 11:03:28 AM MYT +UPDATE AD_Field SET SeqNo=410,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=3744 +; + +-- Nov 6, 2021, 11:03:28 AM MYT +UPDATE AD_Field SET SeqNo=420,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=3745 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=430,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=1027 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=440,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=1028 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=450,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=1568 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=460,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=1569 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=470,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=5381 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=480,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=5383 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=490,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=12418 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=500,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=9286 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=510,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=5910 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=520,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=5911 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=530,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=6130 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=540,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=8307 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=550,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=6343 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=560,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=6344 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=570,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=58973 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=580,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=8608 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=590,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=8613 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=600,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=52015 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=610,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=52016 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=380,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=206800 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=390,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=3744 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=400,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=3745 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=410,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=1027 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=420,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=1028 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=430,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=1568 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=440,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=1569 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=450,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=5381 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=460,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=5383 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=470,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=9286 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=480,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=12418 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=490,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=5910 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=500,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=5911 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=510,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=6130 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=520,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=8307 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=530,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=6343 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=540,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=6344 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=550,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=8608 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=560,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=8613 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=570,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=52015 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=580,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=52016 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=590,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=58973 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=600,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=206544 +; + +-- Nov 6, 2021, 11:04:09 AM MYT +UPDATE AD_Field SET DisplayLogic='@IsBOM@=Y', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2021-11-06 11:04:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206800 +; + +-- Nov 6, 2021, 11:13:36 AM MYT +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 (214619,0,'Shipment/Receipt Line','Line on Shipment or Receipt document','The Shipment/Receipt Line indicates a unique line in a Shipment/Receipt document',325,'M_InOutLine_ID',22,'N','N','N','N','N',0,'N',30,0,0,'Y',TO_DATE('2021-11-06 11:13:36','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-11-06 11:13:36','YYYY-MM-DD HH24:MI:SS'),100,1026,'N','N','D','N','N','N','Y','7932af9e-bccb-4a61-a541-f16ecd5d95b2','N',0,'N','N','N') +; + +-- Nov 6, 2021, 11:13:42 AM MYT +UPDATE AD_Column SET FKConstraintName='MInOutLine_MProduction', FKConstraintType='N',Updated=TO_DATE('2021-11-06 11:13:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=214619 +; + +-- Nov 6, 2021, 11:13:42 AM MYT +ALTER TABLE M_Production ADD M_InOutLine_ID NUMBER(10) DEFAULT NULL +; + +-- Nov 6, 2021, 11:13:42 AM MYT +ALTER TABLE M_Production ADD CONSTRAINT MInOutLine_MProduction FOREIGN KEY (M_InOutLine_ID) REFERENCES m_inoutline(m_inoutline_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Nov 6, 2021, 11:14:43 AM MYT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (206801,'Shipment/Receipt Line','Line on Shipment or Receipt document','The Shipment/Receipt Line indicates a unique line in a Shipment/Receipt document',53344,214619,'Y',0,280,0,'N','N','N','N',0,0,'Y',TO_DATE('2021-11-06 11:14:42','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-11-06 11:14:42','YYYY-MM-DD HH24:MI:SS'),100,'Y','Y','D','2725993e-b462-48c7-adf3-f09f715de63b','Y',250,1,2,1,'N','N','N','N') +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=203487 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=203488 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=206081 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59754 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=62015 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59756 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=202852 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59736 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=62017 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=62018 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=206801 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59755 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59737 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59738 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59757 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59758 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59759 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=202853 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59749 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59748 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59739 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=202629 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=10,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59746 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=20,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59742 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=30,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59745 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=40,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59741 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=50,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59736 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=60,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59740 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59744 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59752 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59743 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=206081 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=140,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=202852 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=150,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59756 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=160,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59737 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=170,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59749 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=180,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59748 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=190,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59755 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=200,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59738 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=210,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=62017 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=220,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=62018 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=230,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=206801 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=240,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59757 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=250,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59758 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=260,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=59759 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=270,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=202853 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=280,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=203487 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=290,IsDisplayedGrid='Y', Updated=getDate(), UpdatedBy=100 WHERE AD_Field_ID=203488 +; + +-- Nov 6, 2021, 2:16:03 PM MYT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,AD_Table_ID,ColumnName,DefaultValue,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,FKConstraintType,IsHtml) VALUES (214620,0,'Auto Produce','Auto create production to fulfill shipment',320,'IsAutoProduce','N',1,'N','N','N','N','N',0,'N',20,0,0,'Y',TO_DATE('2021-11-06 14:16:02','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-11-06 14:16:02','YYYY-MM-DD HH24:MI:SS'),100,203548,'N','N','D','N','N','N','Y','e6e53b6d-f1f6-46fe-9809-462e4d7fbd71','N',0,'N','N','N','N') +; + +-- Nov 6, 2021, 2:16:10 PM MYT +ALTER TABLE M_InOutLine ADD IsAutoProduce CHAR(1) DEFAULT 'N' CHECK (IsAutoProduce IN ('Y','N')) +; + +-- Nov 6, 2021, 2:19:34 PM MYT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (206802,'Auto Produce','Auto create production to fulfill shipment',258,214620,'Y',0,260,0,'N','N','N','N',0,0,'Y',TO_DATE('2021-11-06 14:19:33','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-11-06 14:19:33','YYYY-MM-DD HH24:MI:SS'),100,'Y','Y','D','68fb70d6-058c-41f3-8353-d0a407811541','Y',260,5,2,1,'N','N','N','N') +; + +-- Nov 6, 2021, 2:21:06 PM MYT +UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=2, IsToolbarButton=NULL,Updated=TO_DATE('2021-11-06 14:21:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206802 +; + +SELECT register_migration_script('202111060700_IDEMPIERE-5031.sql') FROM dual +; + diff --git a/migration/i8.2z/postgresql/202111060700_IDEMPIERE-5031.sql b/migration/i8.2z/postgresql/202111060700_IDEMPIERE-5031.sql new file mode 100644 index 0000000000..b8c09c153d --- /dev/null +++ b/migration/i8.2z/postgresql/202111060700_IDEMPIERE-5031.sql @@ -0,0 +1,432 @@ +-- IDEMPIERE-5031 Implement auto produce upon shipment for mfg light +-- Nov 6, 2021, 11:00:18 AM MYT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,PrintName,EntityType,AD_Element_UU) VALUES (203548,0,0,'Y',TO_TIMESTAMP('2021-11-06 11:00:17','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-11-06 11:00:17','YYYY-MM-DD HH24:MI:SS'),100,'IsAutoProduce','Auto Produce','Auto create production to fulfill shipment','Auto Produce','D','49d2748d-90c3-44d6-94e0-7cb5b9e98f29') +; + +-- Nov 6, 2021, 11:00:55 AM MYT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,AD_Table_ID,ColumnName,DefaultValue,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,FKConstraintType,IsHtml) VALUES (214618,0,'Auto Produce','Auto create production to fulfill shipment',208,'IsAutoProduce','N',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2021-11-06 11:00:54','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-11-06 11:00:54','YYYY-MM-DD HH24:MI:SS'),100,203548,'Y','N','D','N','N','N','Y','0837aa88-8aff-4f8a-ad1e-cdb9089bb87c','Y',0,'N','N','N','N') +; + +-- Nov 6, 2021, 11:01:00 AM MYT +ALTER TABLE M_Product ADD COLUMN IsAutoProduce CHAR(1) DEFAULT 'N' CHECK (IsAutoProduce IN ('Y','N')) NOT NULL +; + +-- Nov 6, 2021, 11:02:58 AM MYT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (206800,'Auto Produce','Auto create production to fulfill shipment',180,214618,'Y',0,610,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2021-11-06 11:02:58','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-11-06 11:02:58','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','4626cd57-543b-4e69-8d3c-88800ac77396','Y',600,5,2,1,'N','N','N','N') +; + +-- Nov 6, 2021, 11:03:28 AM MYT +UPDATE AD_Field SET SeqNo=400,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=206800 +; + +-- Nov 6, 2021, 11:03:28 AM MYT +UPDATE AD_Field SET SeqNo=410,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=3744 +; + +-- Nov 6, 2021, 11:03:28 AM MYT +UPDATE AD_Field SET SeqNo=420,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=3745 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=430,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=1027 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=440,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=1028 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=450,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=1568 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=460,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=1569 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=470,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=5381 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=480,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=5383 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=490,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=12418 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=500,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=9286 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=510,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=5910 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=520,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=5911 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=530,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=6130 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=540,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=8307 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=550,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=6343 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=560,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=6344 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=570,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=58973 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=580,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=8608 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=590,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=8613 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=600,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=52015 +; + +-- Nov 6, 2021, 11:03:29 AM MYT +UPDATE AD_Field SET SeqNo=610,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=52016 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=380,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=206800 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=390,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=3744 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=400,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=3745 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=410,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=1027 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=420,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=1028 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=430,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=1568 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=440,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=1569 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=450,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=5381 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=460,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=5383 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=470,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=9286 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=480,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=12418 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=490,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=5910 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=500,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=5911 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=510,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=6130 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=520,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=8307 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=530,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=6343 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=540,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=6344 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=550,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=8608 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=560,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=8613 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=570,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=52015 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=580,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=52016 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=590,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=58973 +; + +-- Nov 6, 2021, 11:03:45 AM MYT +UPDATE AD_Field SET SeqNoGrid=600,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=206544 +; + +-- Nov 6, 2021, 11:04:09 AM MYT +UPDATE AD_Field SET DisplayLogic='@IsBOM@=Y', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-11-06 11:04:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206800 +; + +-- Nov 6, 2021, 11:13:36 AM MYT +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 (214619,0,'Shipment/Receipt Line','Line on Shipment or Receipt document','The Shipment/Receipt Line indicates a unique line in a Shipment/Receipt document',325,'M_InOutLine_ID',22,'N','N','N','N','N',0,'N',30,0,0,'Y',TO_TIMESTAMP('2021-11-06 11:13:36','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-11-06 11:13:36','YYYY-MM-DD HH24:MI:SS'),100,1026,'N','N','D','N','N','N','Y','7932af9e-bccb-4a61-a541-f16ecd5d95b2','N',0,'N','N','N') +; + +-- Nov 6, 2021, 11:13:42 AM MYT +UPDATE AD_Column SET FKConstraintName='MInOutLine_MProduction', FKConstraintType='N',Updated=TO_TIMESTAMP('2021-11-06 11:13:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=214619 +; + +-- Nov 6, 2021, 11:13:42 AM MYT +ALTER TABLE M_Production ADD COLUMN M_InOutLine_ID NUMERIC(10) DEFAULT NULL +; + +-- Nov 6, 2021, 11:13:42 AM MYT +ALTER TABLE M_Production ADD CONSTRAINT MInOutLine_MProduction FOREIGN KEY (M_InOutLine_ID) REFERENCES m_inoutline(m_inoutline_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Nov 6, 2021, 11:14:43 AM MYT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (206801,'Shipment/Receipt Line','Line on Shipment or Receipt document','The Shipment/Receipt Line indicates a unique line in a Shipment/Receipt document',53344,214619,'Y',0,280,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2021-11-06 11:14:42','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-11-06 11:14:42','YYYY-MM-DD HH24:MI:SS'),100,'Y','Y','D','2725993e-b462-48c7-adf3-f09f715de63b','Y',250,1,2,1,'N','N','N','N') +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=203487 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=203488 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=206081 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59754 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=62015 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59756 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=202852 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59736 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=62017 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=62018 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=206801 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59755 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59737 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59738 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59757 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59758 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59759 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=202853 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59749 +; + +-- Nov 6, 2021, 11:14:56 AM MYT +UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59748 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59739 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=202629 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=10,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59746 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=20,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59742 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=30,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59745 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=40,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59741 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=50,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59736 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=60,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59740 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59744 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59752 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59743 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=206081 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=140,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=202852 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=150,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59756 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=160,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59737 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=170,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59749 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=180,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59748 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=190,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59755 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=200,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59738 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=210,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=62017 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=220,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=62018 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=230,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=206801 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=240,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59757 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=250,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59758 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=260,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=59759 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=270,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=202853 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=280,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=203487 +; + +-- Nov 6, 2021, 11:15:05 AM MYT +UPDATE AD_Field SET SeqNoGrid=290,IsDisplayedGrid='Y', Updated=statement_timestamp(), UpdatedBy=100 WHERE AD_Field_ID=203488 +; + +-- Nov 6, 2021, 2:16:03 PM MYT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,AD_Table_ID,ColumnName,DefaultValue,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,FKConstraintType,IsHtml) VALUES (214620,0,'Auto Produce','Auto create production to fulfill shipment',320,'IsAutoProduce','N',1,'N','N','N','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2021-11-06 14:16:02','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-11-06 14:16:02','YYYY-MM-DD HH24:MI:SS'),100,203548,'N','N','D','N','N','N','Y','e6e53b6d-f1f6-46fe-9809-462e4d7fbd71','N',0,'N','N','N','N') +; + +-- Nov 6, 2021, 2:16:10 PM MYT +ALTER TABLE M_InOutLine ADD COLUMN IsAutoProduce CHAR(1) DEFAULT 'N' CHECK (IsAutoProduce IN ('Y','N')) +; + +-- Nov 6, 2021, 2:19:34 PM MYT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (206802,'Auto Produce','Auto create production to fulfill shipment',258,214620,'Y',0,260,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2021-11-06 14:19:33','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-11-06 14:19:33','YYYY-MM-DD HH24:MI:SS'),100,'Y','Y','D','68fb70d6-058c-41f3-8353-d0a407811541','Y',260,5,2,1,'N','N','N','N') +; + +-- Nov 6, 2021, 2:21:06 PM MYT +UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=2, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-11-06 14:21:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206802 +; + +SELECT register_migration_script('202111060700_IDEMPIERE-5031.sql') FROM dual +; + diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java index 83829b9641..6706d944c8 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java @@ -815,7 +815,8 @@ public class CalloutOrder extends CalloutEngine if (Env.isSOTrx(ctx, WindowNo)) { MProduct product = MProduct.get (ctx, M_Product_ID.intValue()); - if (product.isStocked() && Env.getContext(ctx, WindowNo, "IsDropShip").equals("N")) + if (product.isStocked() && Env.getContext(ctx, WindowNo, "IsDropShip").equals("N") + && !(product.isBOM() && product.isVerified() && product.isAutoProduce())) { BigDecimal QtyOrdered = (BigDecimal)mTab.getValue("QtyOrdered"); if (QtyOrdered == null) @@ -1309,7 +1310,8 @@ public class CalloutOrder extends CalloutEngine && QtyOrdered.signum() > 0) // no negative (returns) { MProduct product = MProduct.get (ctx, M_Product_ID); - if (product.isStocked() && Env.getContext(ctx, WindowNo, "IsDropShip").equals("N")) + if (product.isStocked() && Env.getContext(ctx, WindowNo, "IsDropShip").equals("N") + && !(product.isBOM() && product.isVerified() && product.isAutoProduce())) { int M_Warehouse_ID = Env.getContextAsInt(ctx, WindowNo, "M_Warehouse_ID"); int M_AttributeSetInstance_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_AttributeSetInstance_ID"); diff --git a/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java b/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java index e31c9faa2d..0b5fb94454 100644 --- a/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java +++ b/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java @@ -323,8 +323,9 @@ public class InOutGenerate extends SvrProcess MStorageOnHand storage = storages[j]; onHand = onHand.add(storage.getQtyOnHand()); } + boolean autoProduce = product.isBOM() && product.isVerified() && product.isAutoProduce(); boolean fullLine = onHand.compareTo(toDeliver) >= 0 - || toDeliver.signum() < 0; + || toDeliver.signum() < 0 || autoProduce; // Complete Order if (completeOrder && !fullLine) @@ -347,10 +348,10 @@ public class InOutGenerate extends SvrProcess // Availability else if ((MOrder.DELIVERYRULE_Availability.equals(order.getDeliveryRule()) || MOrder.DELIVERYRULE_AfterPayment.equals(order.getDeliveryRule())) && (onHand.signum() > 0 - || toDeliver.signum() < 0)) + || toDeliver.signum() < 0 || autoProduce)) { BigDecimal deliver = toDeliver; - if (deliver.compareTo(onHand) > 0) + if (deliver.compareTo(onHand) > 0 && !autoProduce) deliver = onHand; if (log.isLoggable(Level.FINE)) log.fine("Available - OnHand=" + onHand + " (Unconfirmed=" + unconfirmedShippedQty @@ -530,8 +531,10 @@ public class InOutGenerate extends SvrProcess break; } if (toDeliver.signum() != 0) - { - if (!force) + { + MProduct product = MProduct.get(orderLine.getM_Product_ID()); + boolean autoProduce = product.isBOM() && product.isVerified() && product.isAutoProduce(); + if (!force && toDeliver.signum() > 0 && !autoProduce) { throw new IllegalStateException("Not All Delivered - Remainder=" + toDeliver); } diff --git a/org.adempiere.base/src/org/adempiere/base/event/delegate/AutoProduceEventDelegate.java b/org.adempiere.base/src/org/adempiere/base/event/delegate/AutoProduceEventDelegate.java new file mode 100644 index 0000000000..7efb7c719d --- /dev/null +++ b/org.adempiere.base/src/org/adempiere/base/event/delegate/AutoProduceEventDelegate.java @@ -0,0 +1,227 @@ +/*********************************************************************** + * This file is part of iDempiere ERP Open Source * + * http://www.idempiere.org * + * * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - hengsin * + **********************************************************************/ +package org.adempiere.base.event.delegate; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; + +import org.adempiere.base.annotation.ModelEventTopic; +import org.adempiere.base.annotation.EventTopicDelegate; +import org.adempiere.base.event.annotations.ModelEventDelegate; +import org.adempiere.base.event.annotations.doc.BeforeComplete; +import org.compiere.model.MInOut; +import org.compiere.model.MInOutLine; +import org.compiere.model.MProduct; +import org.compiere.model.MProduction; +import org.compiere.model.MProductionLine; +import org.compiere.model.MStorageOnHand; +import org.compiere.process.ProcessInfo; +import org.compiere.util.Env; +import org.compiere.util.Msg; +import org.compiere.util.Util; +import org.compiere.wf.MWorkflow; +import org.eevolution.model.MPPProductBOM; +import org.eevolution.model.MPPProductBOMLine; +import org.osgi.service.event.Event; + +/** + * + * @author hengsin + * + */ +@EventTopicDelegate +@ModelEventTopic(modelClass = MInOut.class) +public class AutoProduceEventDelegate extends ModelEventDelegate { + /** + * + * @param po + * @param event + */ + public AutoProduceEventDelegate(MInOut po, Event event) { + super(po, event); + } + + @BeforeComplete + public void onBeforeComplete() { + MInOut mInOut = getModel(); + if (mInOut.isSOTrx()) { + String msg = processShipment(mInOut); + if (msg != null) + throw new RuntimeException (msg); + } + } + + private String processShipment(MInOut mInOut) { + // Auto produce if on hand is not sufficient to fulfill order + Map qtyUsedMap = new HashMap(); + for (MInOutLine line : mInOut.getLines(false)) { + + MProduct product = new MProduct(mInOut.getCtx(),line.getM_Product_ID(), mInOut.get_TrxName()); + if (!product.isBOM() || !product.isVerified() || !product.isAutoProduce() || !product.isStocked()) + continue; + + // Find on Hand of product + BigDecimal qtyOnHand = MStorageOnHand.getQtyOnHand(line.getM_Product_ID(),line.getM_Warehouse_ID(), line.getM_AttributeSetInstance_ID(), mInOut.get_TrxName()); + + String key = mInOut.getM_InOut_ID() + "_" + line.getM_Product_ID(); + BigDecimal qty = qtyUsedMap.get(key); + if (qty == null) { + qty = line.getQtyEntered(); + } else { + qtyOnHand = qtyOnHand.subtract(qty); + qty = qty.add(line.getQtyEntered()); + } + qtyUsedMap.put(key, qty); + + if (qtyOnHand.signum() < 0) + qtyOnHand = BigDecimal.ZERO; + + if (qtyOnHand != null && qtyOnHand.compareTo(line.getQtyEntered()) >= 0) { + continue; + } else { + String msg = createProduction(mInOut,line,line.getQtyEntered(),qtyOnHand,line.getM_Product_ID(),new int[]{0},qtyUsedMap); + if( msg!=null ) + return msg; + else { + line.setIsAutoProduce(true); + line.saveEx(); + } + } + } + return null; + } + + private String createProduction(MInOut mInOut, MInOutLine mInOutLine, BigDecimal qtyEntered, BigDecimal qtyOnHand, int endProductID, + int[] productionCount, Map qtyUsedMap) { + String description=Msg.getElement(Env.getCtx(), "M_InOut_ID", true) + " " + mInOut.getDocumentNo(); + + int M_Locator_ID=0; + if (endProductID == mInOutLine.getM_Product_ID()) { + M_Locator_ID = mInOutLine.getM_Locator_ID(); + } else { + MProduct endProduct = MProduct.get(Env.getCtx(), endProductID); + M_Locator_ID = endProduct.getM_Locator_ID() > 0 ? endProduct.getM_Locator_ID() : mInOutLine.getM_Locator_ID(); + } + + BigDecimal productionQty = qtyOnHand.signum() > 0 ? qtyEntered.subtract(qtyOnHand) : qtyEntered; + + // Create production + MProduction production = new MProduction(mInOut.getCtx(),0, mInOut.get_TrxName()); + production.setDescription(description); + production.setAD_Org_ID(mInOut.getAD_Org_ID()); + + String productionName = Msg.getElement(Env.getCtx(), "M_InOut_ID", true) + " " + mInOut.getDocumentNo(); + if (productionCount[0] > 0) { + productionName = productionName + " #"+(productionCount[0]+1); + } else { + productionName = productionName + " #1"; + } + production.setName(productionName); + production.setMovementDate(mInOut.getMovementDate()); + production.setPosted(false); + production.setProcessed(false); + production.setM_Product_ID(endProductID); + production.setM_Locator_ID(M_Locator_ID); + production.setProductionQty(productionQty); + production.setIsCreated(MProduction.ISCREATED_No); + production.setIsUseProductionPlan(false); + if (endProductID == mInOutLine.getM_Product_ID()) { + production.setM_InOutLine_ID(mInOutLine.getM_InOutLine_ID()); + } + production.saveEx(); + + // Create line for end product + MProductionLine productionline = new MProductionLine(mInOut.getCtx(),0, mInOut.get_TrxName()); + productionline.setM_Production_ID(production.getM_Production_ID()); + productionline.setLine(10); + productionline.setAD_Org_ID(mInOut.getAD_Org_ID()); + productionline.setM_Product_ID(endProductID); + productionline.setMovementQty(productionQty); + productionline.setQtyUsed(BigDecimal.ZERO); + productionline.setM_Locator_ID(M_Locator_ID); + productionline.setDescription(Msg.getElement(Env.getCtx(), "M_InOutLine_ID", true) + " #" + mInOutLine.getLine()); + productionline.setIsEndProduct(true); + productionline.saveEx(); + + MPPProductBOM bom = MPPProductBOM.getDefault(MProduct.get(Env.getCtx(), endProductID), mInOut.get_TrxName()); + if (bom == null) + return "Shipment: "+ mInOut.getDocumentNo() + " Line: " + mInOutLine.getLine() +" doesn't contain a valid BOM"; + + MPPProductBOMLine[] bomLines = bom.getLines(); + int lineNo = 10; + for (MPPProductBOMLine bomLine : bomLines) { + BigDecimal bomQty = bomLine.getQtyBOM(); + + MProduct component = new MProduct(mInOut.getCtx(), bomLine.getM_Product_ID(), mInOut.get_TrxName()); + lineNo = lineNo + 10; + // Create Line + productionline = new MProductionLine(mInOut.getCtx(), 0, mInOut.get_TrxName()); + productionline.setM_Production_ID(production.getM_Production_ID()); + productionline.setLine(lineNo); + productionline.setM_Product_ID(bomLine.getM_Product_ID()); + productionline.setAD_Org_ID(mInOut.getAD_Org_ID()); + productionline.setQtyUsed(productionQty.multiply(bomQty)); + M_Locator_ID = MStorageOnHand.getM_Locator_ID(mInOut.getM_Warehouse_ID(), + bomLine.getM_Product_ID(), -1, + productionQty.multiply(bomQty), mInOut.get_TrxName()); + M_Locator_ID = M_Locator_ID > 0 ? M_Locator_ID : (component.getM_Locator_ID() > 0 ? component.getM_Locator_ID() : production.getM_Locator_ID()); + productionline.setM_Locator_ID(M_Locator_ID); + productionline.setIsEndProduct(false); + productionline.saveEx(); + + if (component.isBOM() && component.isVerified()) { + BigDecimal onHandComponent = MStorageOnHand.getQtyOnHand(bomLine.getM_Product_ID(),mInOutLine.getM_Warehouse_ID(),0, mInOut.get_TrxName()); + String key = mInOut.getM_InOut_ID() + "_" + bomLine.getM_Product_ID(); + BigDecimal qty = qtyUsedMap.get(key); + if (qty != null) + onHandComponent = onHandComponent.subtract(qty); + + // insufficient on hand for component + if (onHandComponent.compareTo(productionQty.multiply(bomQty)) < 0) { + boolean produceNestedBOM = component.isBOM() && component.isVerified() && component.isAutoProduce(); + if (produceNestedBOM) { + productionCount[0] = productionCount[0]+1; + String error = createProduction(mInOut,mInOutLine,productionQty.multiply(bomQty),onHandComponent,bomLine.getM_Product_ID(),productionCount,qtyUsedMap); + if (!Util.isEmpty(error)) { + return error; + } + } + } + } + } + + // Indicate that lines have been created + production.setIsCreated(MProduction.ISCREATED_Yes); + production.saveEx(); + + //complete the production + ProcessInfo pi = MWorkflow.runDocumentActionWorkflow(production, "CO"); + if (pi.isError()) { + return pi.getSummary(); + } + return null; + } +} \ No newline at end of file diff --git a/org.adempiere.base/src/org/compiere/model/I_M_InOutLine.java b/org.adempiere.base/src/org/compiere/model/I_M_InOutLine.java index 27feaa9f59..1c9f001d8f 100644 --- a/org.adempiere.base/src/org/compiere/model/I_M_InOutLine.java +++ b/org.adempiere.base/src/org/compiere/model/I_M_InOutLine.java @@ -250,6 +250,19 @@ public interface I_M_InOutLine */ public boolean isActive(); + /** Column name IsAutoProduce */ + public static final String COLUMNNAME_IsAutoProduce = "IsAutoProduce"; + + /** Set Auto Produce. + * Auto create production to fulfill shipment + */ + public void setIsAutoProduce (boolean IsAutoProduce); + + /** Get Auto Produce. + * Auto create production to fulfill shipment + */ + public boolean isAutoProduce(); + /** Column name IsDescription */ public static final String COLUMNNAME_IsDescription = "IsDescription"; diff --git a/org.adempiere.base/src/org/compiere/model/I_M_Product.java b/org.adempiere.base/src/org/compiere/model/I_M_Product.java index 92ac357947..535e1bf88f 100644 --- a/org.adempiere.base/src/org/compiere/model/I_M_Product.java +++ b/org.adempiere.base/src/org/compiere/model/I_M_Product.java @@ -325,6 +325,19 @@ public interface I_M_Product */ public boolean isActive(); + /** Column name IsAutoProduce */ + public static final String COLUMNNAME_IsAutoProduce = "IsAutoProduce"; + + /** Set Auto Produce. + * Auto create production to fulfill shipment + */ + public void setIsAutoProduce (boolean IsAutoProduce); + + /** Get Auto Produce. + * Auto create production to fulfill shipment + */ + public boolean isAutoProduce(); + /** Column name IsBOM */ public static final String COLUMNNAME_IsBOM = "IsBOM"; diff --git a/org.adempiere.base/src/org/compiere/model/I_M_Production.java b/org.adempiere.base/src/org/compiere/model/I_M_Production.java index e4131d3e97..c16051dcd0 100644 --- a/org.adempiere.base/src/org/compiere/model/I_M_Production.java +++ b/org.adempiere.base/src/org/compiere/model/I_M_Production.java @@ -318,6 +318,21 @@ public interface I_M_Production /** Get Use Production Plan */ public boolean isUseProductionPlan(); + /** Column name M_InOutLine_ID */ + public static final String COLUMNNAME_M_InOutLine_ID = "M_InOutLine_ID"; + + /** Set Shipment/Receipt Line. + * Line on Shipment or Receipt document + */ + public void setM_InOutLine_ID (int M_InOutLine_ID); + + /** Get Shipment/Receipt Line. + * Line on Shipment or Receipt document + */ + public int getM_InOutLine_ID(); + + public org.compiere.model.I_M_InOutLine getM_InOutLine() throws RuntimeException; + /** Column name M_Locator_ID */ public static final String COLUMNNAME_M_Locator_ID = "M_Locator_ID"; diff --git a/org.adempiere.base/src/org/compiere/model/X_M_InOutLine.java b/org.adempiere.base/src/org/compiere/model/X_M_InOutLine.java index a4328d7247..3ce80c9893 100644 --- a/org.adempiere.base/src/org/compiere/model/X_M_InOutLine.java +++ b/org.adempiere.base/src/org/compiere/model/X_M_InOutLine.java @@ -33,7 +33,7 @@ public class X_M_InOutLine extends PO implements I_M_InOutLine, I_Persistent /** * */ - private static final long serialVersionUID = 20210917L; + private static final long serialVersionUID = 20211106L; /** Standard Constructor */ public X_M_InOutLine (Properties ctx, int M_InOutLine_ID, String trxName) @@ -379,6 +379,30 @@ public class X_M_InOutLine extends PO implements I_M_InOutLine, I_Persistent return (String)get_Value(COLUMNNAME_Description); } + /** Set Auto Produce. + @param IsAutoProduce + Auto create production to fulfill shipment + */ + public void setIsAutoProduce (boolean IsAutoProduce) + { + set_ValueNoCheck (COLUMNNAME_IsAutoProduce, Boolean.valueOf(IsAutoProduce)); + } + + /** Get Auto Produce. + @return Auto create production to fulfill shipment + */ + public boolean isAutoProduce () + { + Object oo = get_Value(COLUMNNAME_IsAutoProduce); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + /** Set Description Only. @param IsDescription if true, the line is just description and no transaction diff --git a/org.adempiere.base/src/org/compiere/model/X_M_Product.java b/org.adempiere.base/src/org/compiere/model/X_M_Product.java index f4f7174984..cfec560a8a 100644 --- a/org.adempiere.base/src/org/compiere/model/X_M_Product.java +++ b/org.adempiere.base/src/org/compiere/model/X_M_Product.java @@ -34,7 +34,7 @@ public class X_M_Product extends PO implements I_M_Product, I_Persistent /** * */ - private static final long serialVersionUID = 20210917L; + private static final long serialVersionUID = 20211106L; /** Standard Constructor */ public X_M_Product (Properties ctx, int M_Product_ID, String trxName) @@ -44,6 +44,8 @@ public class X_M_Product extends PO implements I_M_Product, I_Persistent { setC_TaxCategory_ID (0); setC_UOM_ID (0); + setIsAutoProduce (false); +// N setIsBOM (false); // N setIsDropShip (false); @@ -472,6 +474,30 @@ public class X_M_Product extends PO implements I_M_Product, I_Persistent return (String)get_Value(COLUMNNAME_ImageURL); } + /** Set Auto Produce. + @param IsAutoProduce + Auto create production to fulfill shipment + */ + public void setIsAutoProduce (boolean IsAutoProduce) + { + set_Value (COLUMNNAME_IsAutoProduce, Boolean.valueOf(IsAutoProduce)); + } + + /** Get Auto Produce. + @return Auto create production to fulfill shipment + */ + public boolean isAutoProduce () + { + Object oo = get_Value(COLUMNNAME_IsAutoProduce); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + /** Set Bill of Materials. @param IsBOM Bill of Materials @@ -1127,8 +1153,6 @@ public class X_M_Product extends PO implements I_M_Product, I_Persistent public static final String PRODUCTTYPE_ExpenseType = "E"; /** Item = I */ public static final String PRODUCTTYPE_Item = "I"; - /** Online = O */ - public static final String PRODUCTTYPE_Online = "O"; /** Resource = R */ public static final String PRODUCTTYPE_Resource = "R"; /** Service = S */ diff --git a/org.adempiere.base/src/org/compiere/model/X_M_Production.java b/org.adempiere.base/src/org/compiere/model/X_M_Production.java index cf5875b46e..b865c9441b 100644 --- a/org.adempiere.base/src/org/compiere/model/X_M_Production.java +++ b/org.adempiere.base/src/org/compiere/model/X_M_Production.java @@ -34,7 +34,7 @@ public class X_M_Production extends PO implements I_M_Production, I_Persistent /** * */ - private static final long serialVersionUID = 20211005L; + private static final long serialVersionUID = 20211106L; /** Standard Constructor */ public X_M_Production (Properties ctx, int M_Production_ID, String trxName) @@ -545,6 +545,35 @@ public class X_M_Production extends PO implements I_M_Production, I_Persistent return false; } + public org.compiere.model.I_M_InOutLine getM_InOutLine() throws RuntimeException + { + return (org.compiere.model.I_M_InOutLine)MTable.get(getCtx(), org.compiere.model.I_M_InOutLine.Table_ID) + .getPO(getM_InOutLine_ID(), get_TrxName()); + } + + /** Set Shipment/Receipt Line. + @param M_InOutLine_ID + Line on Shipment or Receipt document + */ + public void setM_InOutLine_ID (int M_InOutLine_ID) + { + if (M_InOutLine_ID < 1) + set_ValueNoCheck (COLUMNNAME_M_InOutLine_ID, null); + else + set_ValueNoCheck (COLUMNNAME_M_InOutLine_ID, Integer.valueOf(M_InOutLine_ID)); + } + + /** Get Shipment/Receipt Line. + @return Line on Shipment or Receipt document + */ + public int getM_InOutLine_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_M_InOutLine_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + public I_M_Locator getM_Locator() throws RuntimeException { return (I_M_Locator)MTable.get(getCtx(), I_M_Locator.Table_ID) @@ -699,9 +728,10 @@ public class X_M_Production extends PO implements I_M_Production, I_Persistent } public org.eevolution.model.I_PP_Product_BOM getPP_Product_BOM() throws RuntimeException - { - return (org.eevolution.model.I_PP_Product_BOM)MTable.get(getCtx(), org.eevolution.model.I_PP_Product_BOM.Table_Name) - .getPO(getPP_Product_BOM_ID(), get_TrxName()); } + { + return (org.eevolution.model.I_PP_Product_BOM)MTable.get(getCtx(), org.eevolution.model.I_PP_Product_BOM.Table_ID) + .getPO(getPP_Product_BOM_ID(), get_TrxName()); + } /** Set BOM & Formula. @param PP_Product_BOM_ID diff --git a/org.idempiere.test/src/org/idempiere/test/model/ProductionTest.java b/org.idempiere.test/src/org/idempiere/test/model/ProductionTest.java index 7ccbf8659f..661a7b57a2 100644 --- a/org.idempiere.test/src/org/idempiere/test/model/ProductionTest.java +++ b/org.idempiere.test/src/org/idempiere/test/model/ProductionTest.java @@ -26,27 +26,38 @@ package org.idempiere.test.model; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; import java.math.BigDecimal; +import java.sql.Timestamp; import java.util.List; import org.compiere.model.MAccount; import org.compiere.model.MAcctSchema; +import org.compiere.model.MBPartner; import org.compiere.model.MClient; import org.compiere.model.MCost; import org.compiere.model.MCostElement; import org.compiere.model.MFactAcct; +import org.compiere.model.MInOut; +import org.compiere.model.MInOutLine; import org.compiere.model.MInventory; import org.compiere.model.MInventoryLine; +import org.compiere.model.MOrder; +import org.compiere.model.MOrderLine; import org.compiere.model.MPInstance; import org.compiere.model.MPInstancePara; +import org.compiere.model.MPriceList; +import org.compiere.model.MPriceListVersion; import org.compiere.model.MProcess; import org.compiere.model.MProduct; import org.compiere.model.MProductCategory; import org.compiere.model.MProductCategoryAcct; +import org.compiere.model.MProductPrice; import org.compiere.model.MProduction; +import org.compiere.model.MProductionLine; import org.compiere.model.MStorageOnHand; import org.compiere.model.ProductCost; import org.compiere.model.Query; @@ -54,7 +65,9 @@ import org.compiere.process.DocAction; import org.compiere.process.DocumentEngine; import org.compiere.process.ProcessInfo; import org.compiere.process.ServerProcessCtl; +import org.compiere.util.DB; import org.compiere.util.Env; +import org.compiere.util.TimeUtil; import org.compiere.wf.MWorkflow; import org.eevolution.model.MPPProductBOM; import org.eevolution.model.MPPProductBOMLine; @@ -369,4 +382,109 @@ public class ProductionTest extends AbstractTestCase { category.deleteEx(true); } } + + @Test + public void testAutoProduce() { + int mulchId = 137; + int joeBlock = 118; + MProduct mulch = MProduct.get(mulchId); + + MProduct mulchX = new MProduct(Env.getCtx(), 0, null); + mulchX.setName("MulchX2"); + mulchX.setIsBOM(true); + mulchX.setIsStocked(true); + mulchX.setC_UOM_ID(mulch.getC_UOM_ID()); + mulchX.setM_Product_Category_ID(mulch.getM_Product_Category_ID()); + mulchX.setProductType(mulch.getProductType()); + mulchX.setM_AttributeSet_ID(mulch.getM_AttributeSet_ID()); + mulchX.setC_TaxCategory_ID(mulch.getC_TaxCategory_ID()); + mulchX.setIsAutoProduce(true); + mulchX.saveEx(); + + try { + MPPProductBOM bom = new MPPProductBOM(Env.getCtx(), 0, getTrxName()); + bom.setM_Product_ID(mulchX.get_ID()); + bom.setBOMType(MPPProductBOM.BOMTYPE_CurrentActive); + bom.setBOMUse(MPPProductBOM.BOMUSE_Master); + bom.setName(mulchX.getName()); + bom.saveEx(); + + MPPProductBOMLine line = new MPPProductBOMLine(bom); + line.setM_Product_ID(mulchId); + line.setQtyBOM(new BigDecimal("2")); + line.saveEx(); + + mulchX.load((String)null); + mulchX.setIsVerified(true); + mulchX.saveEx(); + + MOrder order = new MOrder(Env.getCtx(), 0, getTrxName()); + //Joe Block + order.setBPartner(MBPartner.get(Env.getCtx(), joeBlock)); + order.setC_DocTypeTarget_ID(MOrder.DocSubTypeSO_Standard); + order.setDeliveryRule(MOrder.DELIVERYRULE_CompleteOrder); + order.setDocStatus(DocAction.STATUS_Drafted); + order.setDocAction(DocAction.ACTION_Complete); + Timestamp today = TimeUtil.getDay(System.currentTimeMillis()); + order.setDateOrdered(today); + order.setDatePromised(today); + order.saveEx(); + + MPriceList priceList = MPriceList.get(order.getM_PriceList_ID()); + MPriceListVersion priceListVersion = priceList.getPriceListVersion(null); + MProductPrice productPrice = new MProductPrice(Env.getCtx(), 0, getTrxName()); + productPrice.setM_PriceList_Version_ID(priceListVersion.get_ID()); + productPrice.setM_Product_ID(mulchX.get_ID()); + productPrice.setPriceLimit(new BigDecimal("5.00")); + productPrice.setPriceStd(new BigDecimal("5.00")); + productPrice.saveEx(); + MOrderLine line1 = new MOrderLine(order); + line1.setLine(10); + line1.setProduct(mulchX); + line1.setQty(new BigDecimal("1")); + line1.setDatePromised(today); + line1.saveEx(); + + ProcessInfo info = MWorkflow.runDocumentActionWorkflow(order, DocAction.ACTION_Complete); + assertFalse(info.isError()); + order.load(getTrxName()); + assertEquals(DocAction.STATUS_Completed, order.getDocStatus()); + line1.load(getTrxName()); + assertEquals(1, line1.getQtyReserved().intValue()); + + MInOut shipment = new MInOut(order, 120, order.getDateOrdered()); + shipment.setDocStatus(DocAction.STATUS_Drafted); + shipment.setDocAction(DocAction.ACTION_Complete); + shipment.saveEx(); + + MInOutLine shipmentLine = new MInOutLine(shipment); + shipmentLine.setOrderLine(line1, 0, new BigDecimal("1")); + shipmentLine.setQty(new BigDecimal("1")); + shipmentLine.saveEx(); + + info = MWorkflow.runDocumentActionWorkflow(shipment, DocAction.ACTION_Complete); + assertFalse(info.isError()); + shipment.load(getTrxName()); + assertEquals(DocAction.STATUS_Completed, shipment.getDocStatus()); + + shipmentLine.load(getTrxName()); + assertTrue(shipmentLine.isAutoProduce(), "Shipment Line Auto Produce is False"); + + Query query = new Query(Env.getCtx(), MProduction.Table_Name, "M_InOutLine_ID=?", getTrxName()); + MProduction production = query.setParameters(shipmentLine.get_ID()).first(); + assertNotNull(production, "Can't find production for auto produce shipment line"); + assertEquals(DocAction.STATUS_Completed, production.getDocStatus()); + MProductionLine[] productionLines = production.getLines(); + assertNotNull(productionLines, "Can't find production line for auto produce shipment line"); + assertTrue(productionLines.length==2,"Number of production line is not 2 as expected ("+productionLines.length+")"); + assertTrue(productionLines[0].getM_Product_ID()==shipmentLine.getM_Product_ID(), "Production Line Production <> Shipment Line Product"); + assertTrue(productionLines[0].getMovementQty().equals(shipmentLine.getMovementQty()), "Production Line Qty <> Shipment Line Qty"); + assertTrue(productionLines[1].getM_Product_ID()==mulchId,"Production Line 2 Product is not the expected component product"); + assertTrue(productionLines[1].getMovementQty().intValue()==-2,"Production Line 2 Qty is not the expected component qty"); + } finally { + rollback(); + DB.executeUpdateEx("delete from m_cost where m_product_id=?", new Object[] {mulchX.get_ID()}, null); + mulchX.deleteEx(true); + } + } }