IDEMPIERE-2671 - Allocation Target Document Type Implementation

This commit is contained in:
michal_zilincar 2015-06-25 14:00:42 +02:00
parent ac5b2bc7e0
commit fa80680f3c
7 changed files with 259 additions and 2 deletions

View File

@ -0,0 +1,95 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-2671 Allocation Target Document Type Implementation
-- Jun 25, 2015 11:07:55 AM CEST
INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200079,'C_DocType Allocation ','S','C_DocType.DocBaseType IN (''CMA'') AND C_DocType.AD_Client_ID=@#AD_Client_ID@',0,0,'Y',TO_DATE('2015-06-25 11:07:55','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-25 11:07:55','YYYY-MM-DD HH24:MI:SS'),100,'D','c44fbb32-1fdf-481b-b1ab-55fd4a3061d5')
;
-- Jun 25, 2015 11:12:09 AM CEST
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,AD_Val_Rule_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Callout,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (212213,0,'Document Type','Document type or rules','The Document Type determines document sequence and processing rules',735,200079,'C_DocType_ID',22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_DATE('2015-06-25 11:12:09','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-25 11:12:09','YYYY-MM-DD HH24:MI:SS'),100,'',196,'N','N','D','N','N','N','Y','b8c76f2b-9c80-4f0a-837d-017f4bc5f4af','Y',0,'N','N')
;
-- Jun 25, 2015 11:12:14 AM CEST
UPDATE AD_Column SET EntityType='D',Updated=TO_DATE('2015-06-25 11:12:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212213
;
-- Jun 25, 2015 11:12:17 AM CEST
UPDATE AD_Column SET FKConstraintName='CDocType_CAllocationHdr', FKConstraintType='N',Updated=TO_DATE('2015-06-25 11:12:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212213
;
-- Jun 25, 2015 11:12:17 AM CEST
ALTER TABLE C_AllocationHdr ADD C_DocType_ID NUMBER(10) DEFAULT NULL
;
-- Jun 25, 2015 11:12:18 AM CEST
ALTER TABLE C_AllocationHdr ADD CONSTRAINT CDocType_CAllocationHdr FOREIGN KEY (C_DocType_ID) REFERENCES c_doctype(c_doctype_id) DEFERRABLE INITIALLY DEFERRED
;
-- Jun 25, 2015 11:12:54 AM 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 (203827,'Document Type','Document type or rules','The Document Type determines document sequence and processing rules',661,212213,'Y',22,170,'N','N','N','N',0,0,'Y',TO_DATE('2015-06-25 11:12:54','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-06-25 11:12:54','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','125524c2-e746-4bdf-8044-a025d3ffa7b4','Y',170,2)
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=30, XPosition=1,Updated=TO_DATE('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203827
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=40, XPosition=4,Updated=TO_DATE('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10438
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=50, XPosition=2,Updated=TO_DATE('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10428
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET SeqNo=60,Updated=TO_DATE('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10429
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET SeqNo=70,Updated=TO_DATE('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10425
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET SeqNo=80,Updated=TO_DATE('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10432
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET SeqNo=90,Updated=TO_DATE('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10437
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET SeqNo=100,Updated=TO_DATE('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10435
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET SeqNo=110,Updated=TO_DATE('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10433
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET SeqNo=120,Updated=TO_DATE('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10440
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET SeqNo=130,Updated=TO_DATE('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10439
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET SeqNo=140,Updated=TO_DATE('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10436
;
-- Jun 25, 2015 11:14:46 AM CEST
UPDATE AD_Field SET SeqNo=150,Updated=TO_DATE('2015-06-25 11:14:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10426
;
-- Jun 25, 2015 11:14:46 AM CEST
UPDATE AD_Field SET SeqNo=160,Updated=TO_DATE('2015-06-25 11:14:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10430
;
-- Jun 25, 2015 11:14:46 AM CEST
UPDATE AD_Field SET SeqNo=170,Updated=TO_DATE('2015-06-25 11:14:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10431
;
SELECT register_migration_script('201507011816_IDEMPIERE-2671.sql') FROM dual
;

View File

@ -0,0 +1,92 @@
-- IDEMPIERE-2671 Allocation Target Document Type Implementation
-- Jun 25, 2015 11:07:55 AM CEST
INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200079,'C_DocType Allocation ','S','C_DocType.DocBaseType IN (''CMA'') AND C_DocType.AD_Client_ID=@#AD_Client_ID@',0,0,'Y',TO_TIMESTAMP('2015-06-25 11:07:55','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-25 11:07:55','YYYY-MM-DD HH24:MI:SS'),100,'D','c44fbb32-1fdf-481b-b1ab-55fd4a3061d5')
;
-- Jun 25, 2015 11:12:09 AM CEST
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,AD_Val_Rule_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Callout,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (212213,0,'Document Type','Document type or rules','The Document Type determines document sequence and processing rules',735,200079,'C_DocType_ID',22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2015-06-25 11:12:09','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-25 11:12:09','YYYY-MM-DD HH24:MI:SS'),100,'',196,'N','N','D','N','N','N','Y','b8c76f2b-9c80-4f0a-837d-017f4bc5f4af','Y',0,'N','N')
;
-- Jun 25, 2015 11:12:14 AM CEST
UPDATE AD_Column SET EntityType='D',Updated=TO_TIMESTAMP('2015-06-25 11:12:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212213
;
-- Jun 25, 2015 11:12:17 AM CEST
UPDATE AD_Column SET FKConstraintName='CDocType_CAllocationHdr', FKConstraintType='N',Updated=TO_TIMESTAMP('2015-06-25 11:12:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212213
;
-- Jun 25, 2015 11:12:17 AM CEST
ALTER TABLE C_AllocationHdr ADD COLUMN C_DocType_ID NUMERIC(10) DEFAULT NULL
;
-- Jun 25, 2015 11:12:18 AM CEST
ALTER TABLE C_AllocationHdr ADD CONSTRAINT CDocType_CAllocationHdr FOREIGN KEY (C_DocType_ID) REFERENCES c_doctype(c_doctype_id) DEFERRABLE INITIALLY DEFERRED
;
-- Jun 25, 2015 11:12:54 AM 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 (203827,'Document Type','Document type or rules','The Document Type determines document sequence and processing rules',661,212213,'Y',22,170,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2015-06-25 11:12:54','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-06-25 11:12:54','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','125524c2-e746-4bdf-8044-a025d3ffa7b4','Y',170,2)
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=30, XPosition=1,Updated=TO_TIMESTAMP('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203827
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=40, XPosition=4,Updated=TO_TIMESTAMP('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10438
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=50, XPosition=2,Updated=TO_TIMESTAMP('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10428
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET SeqNo=60,Updated=TO_TIMESTAMP('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10429
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET SeqNo=70,Updated=TO_TIMESTAMP('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10425
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET SeqNo=80,Updated=TO_TIMESTAMP('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10432
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET SeqNo=90,Updated=TO_TIMESTAMP('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10437
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET SeqNo=100,Updated=TO_TIMESTAMP('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10435
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET SeqNo=110,Updated=TO_TIMESTAMP('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10433
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET SeqNo=120,Updated=TO_TIMESTAMP('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10440
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET SeqNo=130,Updated=TO_TIMESTAMP('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10439
;
-- Jun 25, 2015 11:14:45 AM CEST
UPDATE AD_Field SET SeqNo=140,Updated=TO_TIMESTAMP('2015-06-25 11:14:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10436
;
-- Jun 25, 2015 11:14:46 AM CEST
UPDATE AD_Field SET SeqNo=150,Updated=TO_TIMESTAMP('2015-06-25 11:14:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10426
;
-- Jun 25, 2015 11:14:46 AM CEST
UPDATE AD_Field SET SeqNo=160,Updated=TO_TIMESTAMP('2015-06-25 11:14:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10430
;
-- Jun 25, 2015 11:14:46 AM CEST
UPDATE AD_Field SET SeqNo=170,Updated=TO_TIMESTAMP('2015-06-25 11:14:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10431
;
SELECT register_migration_script('201507011816_IDEMPIERE-2671.sql') FROM dual
;

View File

@ -112,6 +112,21 @@ public interface I_C_AllocationHdr
public org.compiere.model.I_C_Currency getC_Currency() throws RuntimeException; public org.compiere.model.I_C_Currency getC_Currency() throws RuntimeException;
/** Column name C_DocType_ID */
public static final String COLUMNNAME_C_DocType_ID = "C_DocType_ID";
/** Set Document Type.
* Document type or rules
*/
public void setC_DocType_ID (int C_DocType_ID);
/** Get Document Type.
* Document type or rules
*/
public int getC_DocType_ID();
public org.compiere.model.I_C_DocType getC_DocType() throws RuntimeException;
/** Column name Created */ /** Column name Created */
public static final String COLUMNNAME_Created = "Created"; public static final String COLUMNNAME_Created = "Created";

View File

@ -186,6 +186,7 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction
setPosted (false); setPosted (false);
setProcessed (false); setProcessed (false);
setProcessing(false); setProcessing(false);
setC_DocType_ID(MDocType.getDocType("CMA"));
} }
} // MAllocation } // MAllocation
@ -213,6 +214,7 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction
setDescription(description); setDescription(description);
} // create Allocation } // create Allocation
/** /**
* Load Constructor * Load Constructor
* @param ctx context * @param ctx context

View File

@ -33,7 +33,7 @@ public class X_C_AllocationHdr extends PO implements I_C_AllocationHdr, I_Persis
/** /**
* *
*/ */
private static final long serialVersionUID = 20141030L; private static final long serialVersionUID = 20150625L;
/** Standard Constructor */ /** Standard Constructor */
public X_C_AllocationHdr (Properties ctx, int C_AllocationHdr_ID, String trxName) public X_C_AllocationHdr (Properties ctx, int C_AllocationHdr_ID, String trxName)
@ -171,6 +171,34 @@ public class X_C_AllocationHdr extends PO implements I_C_AllocationHdr, I_Persis
return ii.intValue(); return ii.intValue();
} }
public org.compiere.model.I_C_DocType getC_DocType() throws RuntimeException
{
return (org.compiere.model.I_C_DocType)MTable.get(getCtx(), org.compiere.model.I_C_DocType.Table_Name)
.getPO(getC_DocType_ID(), get_TrxName()); }
/** Set Document Type.
@param C_DocType_ID
Document type or rules
*/
public void setC_DocType_ID (int C_DocType_ID)
{
if (C_DocType_ID < 0)
set_ValueNoCheck (COLUMNNAME_C_DocType_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_DocType_ID, Integer.valueOf(C_DocType_ID));
}
/** Get Document Type.
@return Document type or rules
*/
public int getC_DocType_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_DocType_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Account Date. /** Set Account Date.
@param DateAcct @param DateAcct
Accounting Date Accounting Date

View File

@ -135,6 +135,8 @@ public class WAllocation extends Allocation
private Checkbox multiCurrency = new Checkbox(); private Checkbox multiCurrency = new Checkbox();
private Label chargeLabel = new Label(); private Label chargeLabel = new Label();
private WTableDirEditor chargePick = null; private WTableDirEditor chargePick = null;
private Label DocTypeLabel = new Label();
private WTableDirEditor DocTypePick = null;
private Label allocCurrencyLabel = new Label(); private Label allocCurrencyLabel = new Label();
private Hlayout statusBar = new Hlayout(); private Hlayout statusBar = new Hlayout();
private Label dateLabel = new Label(); private Label dateLabel = new Label();
@ -170,6 +172,7 @@ public class WAllocation extends Allocation
invoiceInfo.setText("."); invoiceInfo.setText(".");
paymentInfo.setText("."); paymentInfo.setText(".");
chargeLabel.setText(" " + Msg.translate(Env.getCtx(), "C_Charge_ID")); chargeLabel.setText(" " + Msg.translate(Env.getCtx(), "C_Charge_ID"));
DocTypeLabel.setText(" " + Msg.translate(Env.getCtx(), "C_DocType_ID"));
differenceLabel.setText(Msg.getMsg(Env.getCtx(), "Difference")); differenceLabel.setText(Msg.getMsg(Env.getCtx(), "Difference"));
differenceField.setText("0"); differenceField.setText("0");
differenceField.setReadonly(true); differenceField.setReadonly(true);
@ -232,6 +235,9 @@ public class WAllocation extends Allocation
row.appendCellChild(chargeLabel.rightAlign()); row.appendCellChild(chargeLabel.rightAlign());
chargePick.getComponent().setHflex("true"); chargePick.getComponent().setHflex("true");
row.appendCellChild(chargePick.getComponent()); row.appendCellChild(chargePick.getComponent());
row.appendCellChild(DocTypeLabel.rightAlign());
DocTypePick.getComponent().setHflex("true");
row.appendCellChild(DocTypePick.getComponent());
allocateButton.setHflex("true"); allocateButton.setHflex("true");
row.appendCellChild(allocateButton); row.appendCellChild(allocateButton);
row.appendCellChild(refreshButton); row.appendCellChild(refreshButton);
@ -351,6 +357,14 @@ public class WAllocation extends Allocation
chargePick = new WTableDirEditor("C_Charge_ID", false, false, true, lookupCharge); chargePick = new WTableDirEditor("C_Charge_ID", false, false, true, lookupCharge);
chargePick.setValue(new Integer(m_C_Charge_ID)); chargePick.setValue(new Integer(m_C_Charge_ID));
chargePick.addValueChangeListener(this); chargePick.addValueChangeListener(this);
// Charge
AD_Column_ID = 212213; // C_AllocationLine.C_Charge_ID
MLookup lookupDocType = MLookupFactory.get (Env.getCtx(), form.getWindowNo(), 0, AD_Column_ID, DisplayType.TableDir);
DocTypePick = new WTableDirEditor("C_DocType_ID", false, false, true, lookupDocType);
DocTypePick.setValue(new Integer(m_C_DocType_ID));
DocTypePick.addValueChangeListener(this);
} // dynInit } // dynInit
/************************************************************************** /**************************************************************************
@ -431,7 +445,7 @@ public class WAllocation extends Allocation
String name = e.getPropertyName(); String name = e.getPropertyName();
Object value = e.getNewValue(); Object value = e.getNewValue();
if (log.isLoggable(Level.CONFIG)) log.config(name + "=" + value); if (log.isLoggable(Level.CONFIG)) log.config(name + "=" + value);
if (value == null && !name.equals("C_Charge_ID")) if (value == null && (!name.equals("C_Charge_ID")||!name.equals("C_DocType_ID") ))
return; return;
// Organization // Organization
@ -449,6 +463,12 @@ public class WAllocation extends Allocation
setAllocateButton(); setAllocateButton();
} }
else if (name.equals("C_DocType_ID") )
{
m_C_DocType_ID = value!=null? ((Integer) value).intValue() : 0;
}
// BPartner // BPartner
if (name.equals("C_BPartner_ID")) if (name.equals("C_BPartner_ID"))
{ {

View File

@ -27,6 +27,7 @@ import org.adempiere.exceptions.AdempiereException;
import org.compiere.minigrid.IMiniTable; import org.compiere.minigrid.IMiniTable;
import org.compiere.model.MAllocationHdr; import org.compiere.model.MAllocationHdr;
import org.compiere.model.MAllocationLine; import org.compiere.model.MAllocationLine;
import org.compiere.model.MDocType;
import org.compiere.model.MInvoice; import org.compiere.model.MInvoice;
import org.compiere.model.MPayment; import org.compiere.model.MPayment;
import org.compiere.model.MRole; import org.compiere.model.MRole;
@ -51,6 +52,7 @@ public class Allocation
private boolean m_calculating = false; private boolean m_calculating = false;
public int m_C_Currency_ID = 0; public int m_C_Currency_ID = 0;
public int m_C_Charge_ID = 0; public int m_C_Charge_ID = 0;
public int m_C_DocType_ID = 0;
public int m_C_BPartner_ID = 0; public int m_C_BPartner_ID = 0;
private int m_noInvoices = 0; private int m_noInvoices = 0;
private int m_noPayments = 0; private int m_noPayments = 0;
@ -81,6 +83,8 @@ public class Allocation
if (log.isLoggable(Level.INFO)) log.info("Currency=" + m_C_Currency_ID); if (log.isLoggable(Level.INFO)) log.info("Currency=" + m_C_Currency_ID);
m_AD_Org_ID = Env.getAD_Org_ID(Env.getCtx()); m_AD_Org_ID = Env.getAD_Org_ID(Env.getCtx());
m_C_DocType_ID= MDocType.getDocType("CMA");
} }
/** /**
@ -654,6 +658,7 @@ public class Allocation
MAllocationHdr alloc = new MAllocationHdr (Env.getCtx(), true, // manual MAllocationHdr alloc = new MAllocationHdr (Env.getCtx(), true, // manual
DateTrx, C_Currency_ID, Env.getContext(Env.getCtx(), "#AD_User_Name"), trxName); DateTrx, C_Currency_ID, Env.getContext(Env.getCtx(), "#AD_User_Name"), trxName);
alloc.setAD_Org_ID(AD_Org_ID); alloc.setAD_Org_ID(AD_Org_ID);
alloc.setC_DocType_ID(m_C_DocType_ID);
alloc.saveEx(); alloc.saveEx();
// For all invoices // For all invoices
BigDecimal unmatchedApplied = Env.ZERO; BigDecimal unmatchedApplied = Env.ZERO;