From 034edcb94df962da76faeeebd4c9156f449aa283 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 20 Apr 2015 15:20:07 -0500 Subject: [PATCH] IDEMPIERE-475 Show quotation number on invoice / based on patch from Nicolas Micoud (nmicoud) --- .../oracle/201504201502_IDEMPIERE-475.sql | 35 +++++++++++++++++++ .../postgresql/201504201502_IDEMPIERE-475.sql | 32 +++++++++++++++++ .../src/org/compiere/process/CopyOrder.java | 1 + .../src/org/compiere/model/I_C_Order.java | 15 ++++++++ .../src/org/compiere/model/X_C_Order.java | 30 +++++++++++++++- 5 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 migration/i2.1/oracle/201504201502_IDEMPIERE-475.sql create mode 100644 migration/i2.1/postgresql/201504201502_IDEMPIERE-475.sql diff --git a/migration/i2.1/oracle/201504201502_IDEMPIERE-475.sql b/migration/i2.1/oracle/201504201502_IDEMPIERE-475.sql new file mode 100644 index 0000000000..a7c67ac2b0 --- /dev/null +++ b/migration/i2.1/oracle/201504201502_IDEMPIERE-475.sql @@ -0,0 +1,35 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-475 Show quotation number on invoice +-- Apr 20, 2015 2:46:17 PM COT +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 (200199,0,0,'Y',TO_DATE('2015-04-20 14:46:17','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-04-20 14:46:17','YYYY-MM-DD HH24:MI:SS'),100,'QuotationOrder_ID','Quotation','Quotation used for generating this order','Quotation','D','2490fc7b-55b8-4957-b7b3-66d92142f301') +; + +-- Apr 20, 2015 2:50:54 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Reference_Value_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) VALUES (200819,0,'Quotation','Quotation used for generating this order',259,'QuotationOrder_ID',10,'N','N','N','N','N',0,'N',30,290,0,0,'Y',TO_DATE('2015-04-20 14:50:54','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-04-20 14:50:54','YYYY-MM-DD HH24:MI:SS'),100,200199,'Y','N','D','N','N','N','Y','f0bc7f90-eca2-412b-ae6f-da8fe38b08d3','Y',0,'N','N') +; + +-- Apr 20, 2015 2:57:31 PM COT +UPDATE AD_Column SET FKConstraintName='QuotationOrder_COrder', FKConstraintType='N',Updated=TO_DATE('2015-04-20 14:57:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200819 +; + +-- Apr 20, 2015 2:57:31 PM COT +ALTER TABLE C_Order ADD QuotationOrder_ID NUMBER(10) DEFAULT NULL +; + +-- Apr 20, 2015 2:57:32 PM COT +ALTER TABLE C_Order ADD CONSTRAINT QuotationOrder_COrder FOREIGN KEY (QuotationOrder_ID) REFERENCES c_order(c_order_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Apr 20, 2015 2:58:16 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,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 (200756,'Quotation','Quotation used for generating this order',186,200819,'Y',10,570,'N','N','N','N',0,0,'Y',TO_DATE('2015-04-20 14:58:16','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-04-20 14:58:16','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','479c2982-2986-4b25-9171-172921522732','Y',570,2) +; + +-- Apr 20, 2015 3:00:55 PM COT +UPDATE AD_Field SET DisplayLogic='@QuotationOrder_ID@>0', IsReadOnly='Y',Updated=TO_DATE('2015-04-20 15:00:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200756 +; + +SELECT register_migration_script('201504201502_IDEMPIERE-475.sql') FROM dual +; + diff --git a/migration/i2.1/postgresql/201504201502_IDEMPIERE-475.sql b/migration/i2.1/postgresql/201504201502_IDEMPIERE-475.sql new file mode 100644 index 0000000000..7e9482b05e --- /dev/null +++ b/migration/i2.1/postgresql/201504201502_IDEMPIERE-475.sql @@ -0,0 +1,32 @@ +-- IDEMPIERE-475 Show quotation number on invoice +-- Apr 20, 2015 2:46:17 PM COT +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 (200199,0,0,'Y',TO_TIMESTAMP('2015-04-20 14:46:17','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-04-20 14:46:17','YYYY-MM-DD HH24:MI:SS'),100,'QuotationOrder_ID','Quotation','Quotation used for generating this order','Quotation','D','2490fc7b-55b8-4957-b7b3-66d92142f301') +; + +-- Apr 20, 2015 2:50:54 PM COT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Reference_Value_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) VALUES (200819,0,'Quotation','Quotation used for generating this order',259,'QuotationOrder_ID',10,'N','N','N','N','N',0,'N',30,290,0,0,'Y',TO_TIMESTAMP('2015-04-20 14:50:54','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-04-20 14:50:54','YYYY-MM-DD HH24:MI:SS'),100,200199,'Y','N','D','N','N','N','Y','f0bc7f90-eca2-412b-ae6f-da8fe38b08d3','Y',0,'N','N') +; + +-- Apr 20, 2015 2:57:31 PM COT +UPDATE AD_Column SET FKConstraintName='QuotationOrder_COrder', FKConstraintType='N',Updated=TO_TIMESTAMP('2015-04-20 14:57:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200819 +; + +-- Apr 20, 2015 2:57:31 PM COT +ALTER TABLE C_Order ADD COLUMN QuotationOrder_ID NUMERIC(10) DEFAULT NULL +; + +-- Apr 20, 2015 2:57:32 PM COT +ALTER TABLE C_Order ADD CONSTRAINT QuotationOrder_COrder FOREIGN KEY (QuotationOrder_ID) REFERENCES c_order(c_order_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Apr 20, 2015 2:58:16 PM COT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,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 (200756,'Quotation','Quotation used for generating this order',186,200819,'Y',10,570,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2015-04-20 14:58:16','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-04-20 14:58:16','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','479c2982-2986-4b25-9171-172921522732','Y',570,2) +; + +-- Apr 20, 2015 3:00:55 PM COT +UPDATE AD_Field SET DisplayLogic='@QuotationOrder_ID@>0', IsReadOnly='Y',Updated=TO_TIMESTAMP('2015-04-20 15:00:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200756 +; + +SELECT register_migration_script('201504201502_IDEMPIERE-475.sql') FROM dual +; + diff --git a/org.adempiere.base.process/src/org/compiere/process/CopyOrder.java b/org.adempiere.base.process/src/org/compiere/process/CopyOrder.java index 7b00d93de2..39bfd075b7 100644 --- a/org.adempiere.base.process/src/org/compiere/process/CopyOrder.java +++ b/org.adempiere.base.process/src/org/compiere/process/CopyOrder.java @@ -86,6 +86,7 @@ public class CopyOrder extends SvrProcess MOrder newOrder = MOrder.copyFrom (from, p_DateDoc, dt.getC_DocType_ID(), dt.isSOTrx(), false, true, get_TrxName()); // copy ASI newOrder.setC_DocTypeTarget_ID(p_C_DocType_ID); + newOrder.setQuotationOrder_ID(from.getC_Order_ID()); // IDEMPIERE-475 boolean OK = newOrder.save(); if (!OK) throw new IllegalStateException("Could not create new Order"); diff --git a/org.adempiere.base/src/org/compiere/model/I_C_Order.java b/org.adempiere.base/src/org/compiere/model/I_C_Order.java index 151e506e1d..2abfe29438 100644 --- a/org.adempiere.base/src/org/compiere/model/I_C_Order.java +++ b/org.adempiere.base/src/org/compiere/model/I_C_Order.java @@ -1071,6 +1071,21 @@ public interface I_C_Order */ public String getPromotionCode(); + /** Column name QuotationOrder_ID */ + public static final String COLUMNNAME_QuotationOrder_ID = "QuotationOrder_ID"; + + /** Set Quotation. + * Quotation used for generating this order + */ + public void setQuotationOrder_ID (int QuotationOrder_ID); + + /** Get Quotation. + * Quotation used for generating this order + */ + public int getQuotationOrder_ID(); + + public org.compiere.model.I_C_Order getQuotationOrder() throws RuntimeException; + /** Column name Ref_Order_ID */ public static final String COLUMNNAME_Ref_Order_ID = "Ref_Order_ID"; diff --git a/org.adempiere.base/src/org/compiere/model/X_C_Order.java b/org.adempiere.base/src/org/compiere/model/X_C_Order.java index 37c68b26ce..c33ece73fa 100644 --- a/org.adempiere.base/src/org/compiere/model/X_C_Order.java +++ b/org.adempiere.base/src/org/compiere/model/X_C_Order.java @@ -33,7 +33,7 @@ public class X_C_Order extends PO implements I_C_Order, I_Persistent /** * */ - private static final long serialVersionUID = 20141030L; + private static final long serialVersionUID = 20150420L; /** Standard Constructor */ public X_C_Order (Properties ctx, int C_Order_ID, String trxName) @@ -1983,6 +1983,34 @@ public class X_C_Order extends PO implements I_C_Order, I_Persistent return (String)get_Value(COLUMNNAME_PromotionCode); } + public org.compiere.model.I_C_Order getQuotationOrder() throws RuntimeException + { + return (org.compiere.model.I_C_Order)MTable.get(getCtx(), org.compiere.model.I_C_Order.Table_Name) + .getPO(getQuotationOrder_ID(), get_TrxName()); } + + /** Set Quotation. + @param QuotationOrder_ID + Quotation used for generating this order + */ + public void setQuotationOrder_ID (int QuotationOrder_ID) + { + if (QuotationOrder_ID < 1) + set_Value (COLUMNNAME_QuotationOrder_ID, null); + else + set_Value (COLUMNNAME_QuotationOrder_ID, Integer.valueOf(QuotationOrder_ID)); + } + + /** Get Quotation. + @return Quotation used for generating this order + */ + public int getQuotationOrder_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_QuotationOrder_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + public org.compiere.model.I_C_Order getRef_Order() throws RuntimeException { return (org.compiere.model.I_C_Order)MTable.get(getCtx(), org.compiere.model.I_C_Order.Table_Name)