IDEMPIERE-589 Add DocAction to Import Inventory

This commit is contained in:
David Peñuela 2013-02-14 12:32:20 -05:00
parent 1512899018
commit 91f05e4195
3 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,12 @@
-- Feb 7, 2013 4:58:19 PM COT
--
INSERT INTO AD_Process_Para (IsRange,AD_Element_ID,AD_Process_Para_ID,AD_Process_Para_UU,Help,AD_Process_ID,AD_Reference_ID,AD_Val_Rule_ID,IsMandatory,AD_Reference_Value_ID,EntityType,Name,ColumnName,Description,FieldLength,IsCentrallyMaintained,SeqNo,DefaultValue,IsActive,UpdatedBy,Updated,CreatedBy,Created,AD_Org_ID,AD_Client_ID,IsEncrypted) VALUES ('N',287,200050,'c0dce1df-786b-44cc-b78f-408e2d1bed5a','You find the current status in the Document Status field. The options are listed in a popup',219,17,219,'N',135,'D','Action','DocAction','The targeted status of the document',1,'Y',35,'PR','Y',0,TO_DATE('2013-02-07 11:41:38','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2013-02-07 11:39:00','YYYY-MM-DD HH24:MI:SS'),0,0,'N')
;
-- Feb 8, 2013 4:58:19 PM COT
--
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Help,Name,Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Process_Para_Trl_UU ) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Help,t.Name,t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=200050 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID)
;
SELECT register_migration_script('IDEMPIERE-589.sql') FROM dual
;

View File

@ -0,0 +1,13 @@
-- Feb 8, 2013 4:58:19 PM COT
--
INSERT INTO AD_Process_Para (IsRange,AD_Element_ID,AD_Process_Para_ID,AD_Process_Para_UU,Help,AD_Process_ID,AD_Reference_ID,AD_Val_Rule_ID,IsMandatory,AD_Reference_Value_ID,EntityType,Name,ColumnName,Description,FieldLength,IsCentrallyMaintained,SeqNo,DefaultValue,IsActive,UpdatedBy,Updated,CreatedBy,Created,AD_Org_ID,AD_Client_ID,IsEncrypted) VALUES ('N',287,200050,'c0dce1df-786b-44cc-b78f-408e2d1bed5a','You find the current status in the Document Status field. The options are listed in a popup',219,17,219,'N',135,'D','Action','DocAction','The targeted status of the document',1,'Y',35,'PR','Y',0,TO_TIMESTAMP('2013-02-07 11:41:38','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2013-02-07 11:39:00','YYYY-MM-DD HH24:MI:SS'),0,0,'N')
;
-- Feb 8, 2013 4:58:19 PM COT
--
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Help,Name,Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Process_Para_Trl_UU ) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Help,t.Name,t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=200050 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID)
;
SELECT register_migration_script('IDEMPIERE-589.sql') FROM dual
;

View File

@ -69,6 +69,8 @@ public class ImportInventory extends SvrProcess
private int p_M_CostElement_ID = 0; private int p_M_CostElement_ID = 0;
/** Organization for which Costing record must be updated */ /** Organization for which Costing record must be updated */
private int p_AD_OrgTrx_ID = 0; private int p_AD_OrgTrx_ID = 0;
/** Document Action */
private String m_docAction = MInventory.DOCACTION_Prepare;
/** /**
* Prepare - e.g., get Parameters. * Prepare - e.g., get Parameters.
@ -101,6 +103,8 @@ public class ImportInventory extends SvrProcess
p_M_CostElement_ID = ((BigDecimal)para[i].getParameter()).intValue(); p_M_CostElement_ID = ((BigDecimal)para[i].getParameter()).intValue();
else if (name.equals("AD_OrgTrx_ID")) else if (name.equals("AD_OrgTrx_ID"))
p_AD_OrgTrx_ID = ((BigDecimal)para[i].getParameter()).intValue(); p_AD_OrgTrx_ID = ((BigDecimal)para[i].getParameter()).intValue();
else if (name.equals("DocAction"))
m_docAction = (String)para[i].getParameter();
else else
log.log(Level.SEVERE, "Unknown Parameter: " + name); log.log(Level.SEVERE, "Unknown Parameter: " + name);
} }
@ -358,6 +362,14 @@ public class ImportInventory extends SvrProcess
x_isInternalUse = isInternalUse; x_isInternalUse = isInternalUse;
noInsert++; noInsert++;
} }
else if (inventory != null){
if (!inventory.processIt(m_docAction)) {
log.warning("Inventory Process Failed: " + inventory + " - " + inventory.getProcessMsg());
throw new IllegalStateException("Inventory Process Failed: " + inventory + " - " + inventory.getProcessMsg());
}
inventory.saveEx();
}
MProduct product = MProduct.get(getCtx(), imp.getM_Product_ID()); MProduct product = MProduct.get(getCtx(), imp.getM_Product_ID());
// Line // Line
int M_AttributeSetInstance_ID = 0; int M_AttributeSetInstance_ID = 0;