IDEMPIERE-661 OrderLineCreateProduction not passing accounting data from SO to Production

This commit is contained in:
Carlos Ruiz 2013-03-17 16:31:01 -05:00
parent 6998c63e9b
commit ea40c1a8bf
4 changed files with 94 additions and 5 deletions

View File

@ -0,0 +1,21 @@
-- Mar 13, 2013 4:02:09 PM COT
-- IDEMPIERE-661 OrderLineCreateProduction not passing accounting data from SO to Production
UPDATE AD_Column SET ColumnSQL=NULL, IsAllowCopy='N',Updated=TO_DATE('2013-03-13 16:02:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=61942
;
-- Mar 13, 2013 4:02:19 PM COT
-- IDEMPIERE-661 OrderLineCreateProduction not passing accounting data from SO to Production
ALTER TABLE M_Production ADD C_BPartner_ID NUMBER(10) DEFAULT NULL
;
update m_production
set c_bpartner_id=(select o.c_bpartner_id from c_order o join c_orderline ol on o.c_order_id=ol.c_order_id where ol.c_orderline_id=m_production.c_orderline_id)
where c_orderline_id>0
;
-- Mar 17, 2013 4:23:40 PM COT
UPDATE AD_Table SET AD_Window_ID=53127,Updated=TO_DATE('2013-03-17 16:23:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=325
;
SELECT register_migration_script('201303131830_IDEMPIERE-661.sql') FROM dual
;

View File

@ -0,0 +1,21 @@
-- Mar 13, 2013 4:02:09 PM COT
-- IDEMPIERE-661 OrderLineCreateProduction not passing accounting data from SO to Production
UPDATE AD_Column SET ColumnSQL=NULL, IsAllowCopy='N',Updated=TO_TIMESTAMP('2013-03-13 16:02:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=61942
;
-- Mar 13, 2013 4:02:19 PM COT
-- IDEMPIERE-661 OrderLineCreateProduction not passing accounting data from SO to Production
ALTER TABLE M_Production ADD COLUMN C_BPartner_ID NUMERIC(10) DEFAULT NULL
;
update m_production
set c_bpartner_id=(select o.c_bpartner_id from c_order o join c_orderline ol on o.c_order_id=ol.c_order_id where ol.c_orderline_id=m_production.c_orderline_id)
where c_orderline_id>0
;
-- Mar 17, 2013 4:23:40 PM COT
UPDATE AD_Table SET AD_Window_ID=53127,Updated=TO_TIMESTAMP('2013-03-17 16:23:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=325
;
SELECT register_migration_script('201303131830_IDEMPIERE-661.sql') FROM dual
;

View File

@ -27,6 +27,7 @@ import org.compiere.model.MProduction;
import org.compiere.model.MWarehouse;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
/**
* Create (Generate) Invoice from Shipment
@ -125,14 +126,56 @@ public class OrderLineCreateProduction extends SvrProcess
if ( locator == 0 )
locator = MWarehouse.get(getCtx(), line.getM_Warehouse_ID()).getDefaultLocator().get_ID();
production.setM_Locator_ID(locator);
if (line.getC_BPartner_ID() > 0) {
production.setC_BPartner_ID(order.getC_BPartner_ID());
}
if (line.getC_Project_ID() > 0 ) {
production.setC_Project_ID(line.getC_Project_ID());
} else {
production.setC_Project_ID(order.getC_Project_ID());
}
if (line.getC_Campaign_ID() > 0) {
production.setC_Campaign_ID(line.getC_Campaign_ID());
} else {
production.setC_Campaign_ID(order.getC_Campaign_ID());
}
if (line.getC_Activity_ID() > 0) {
production.setC_Activity_ID(line.getC_Activity_ID());
} else {
production.setC_Activity_ID(order.getC_Activity_ID());
}
if (line.getUser1_ID() > 0) {
production.setUser1_ID(line.getUser1_ID());
} else {
production.setUser1_ID(order.getUser1_ID());
}
if (line.getUser2_ID() > 0) {
production.setUser2_ID(line.getUser2_ID());
} else {
production.setUser2_ID(order.getUser2_ID());
}
if (line.getAD_OrgTrx_ID() > 0) {
production.setAD_OrgTrx_ID(line.getAD_OrgTrx_ID());
} else {
production.setAD_OrgTrx_ID(order.getAD_OrgTrx_ID());
}
production.saveEx();
production.createLines(false);
production.setIsCreated("Y");
production.saveEx();
StringBuilder msgreturn = new StringBuilder("Production created -- ").append(production.get_ValueAsString("DocumentNo"));
return msgreturn.toString();
String msg = Msg.parseTranslation(getCtx(), "@M_Production_ID@ @Created@ " + production.getDocumentNo());
addLog(production.getM_Production_ID(), null, null, msg, MProduction.Table_ID, production.getM_Production_ID());
return "@OK@";
} // OrderLineCreateShipment
} // OrderLineCreateShipment

View File

@ -33,7 +33,7 @@ public class X_M_Production extends PO implements I_M_Production, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20121031L;
private static final long serialVersionUID = 20130317L;
/** Standard Constructor */
public X_M_Production (Properties ctx, int M_Production_ID, String trxName)
@ -146,7 +146,11 @@ public class X_M_Production extends PO implements I_M_Production, I_Persistent
*/
public void setC_BPartner_ID (int C_BPartner_ID)
{
throw new IllegalArgumentException ("C_BPartner_ID is virtual column"); }
if (C_BPartner_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_BPartner_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_BPartner_ID, Integer.valueOf(C_BPartner_ID));
}
/** Get Business Partner .
@return Identifies a Business Partner