hg merge release-2.0 (merge release2 into development)

This commit is contained in:
Carlos Ruiz 2014-02-07 16:08:03 -05:00
commit 51b70dfa33
6 changed files with 54 additions and 4 deletions

View File

@ -0,0 +1,11 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Feb 7, 2014 3:29:48 PM COT
-- IDEMPIERE-1732 two users can complete same M_InOut and data is corrupted
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Org_ID,Created,AD_Client_ID) VALUES ('E','Document status has been changed by other session, please refresh the record and try again.',200254,'D','de43afaf-61eb-4b85-bedd-5c599133a3f9','DocStatusChanged','Y',TO_DATE('2014-02-07 15:29:46','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_DATE('2014-02-07 15:29:46','YYYY-MM-DD HH24:MI:SS'),0)
;
SELECT register_migration_script('201402071531_IDEMPIERE-1732.sql') FROM dual
;

View File

@ -0,0 +1,8 @@
-- Feb 7, 2014 3:29:48 PM COT
-- IDEMPIERE-1732 two users can complete same M_InOut and data is corrupted
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Org_ID,Created,AD_Client_ID) VALUES ('E','Document status has been changed by other session, please refresh the record and try again.',200254,'D','de43afaf-61eb-4b85-bedd-5c599133a3f9','DocStatusChanged','Y',TO_TIMESTAMP('2014-02-07 15:29:46','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_TIMESTAMP('2014-02-07 15:29:46','YYYY-MM-DD HH24:MI:SS'),0)
;
SELECT register_migration_script('201402071531_IDEMPIERE-1732.sql') FROM dual
;

View File

@ -403,6 +403,16 @@ public class Doc_MatchInv extends Doc
as.getC_Currency_ID(), ipv.negate());
updateFactLine(line);
line = fact.createLine(null, account, as.getC_Currency_ID(), ipv);
updateFactLine(line);
} else if (X_M_Cost.COSTINGMETHOD_AverageInvoice.equals(costingMethod) && !zeroQty) {
MAccount account = m_pc.getAccount(ProductCost.ACCTTYPE_P_Asset, as);
FactLine line = fact.createLine(null,
m_pc.getAccount(ProductCost.ACCTTYPE_P_IPV, as),
as.getC_Currency_ID(), ipv.negate());
updateFactLine(line);
line = fact.createLine(null, account, as.getC_Currency_ID(), ipv);
updateFactLine(line);
}

View File

@ -1828,6 +1828,18 @@ public class MInvoice extends X_C_Invoice implements DocAction
matchPO++;
if (!po.isPosted() && po.getM_InOutLine_ID() > 0) // match po don't post if receipt is not assigned, and it doesn't create avg po record
addDocsPostProcess(po);
MMatchInv[] matchInvoices = MMatchInv.getInvoiceLine(getCtx(), line.getC_InvoiceLine_ID(), get_TrxName());
if (matchInvoices != null && matchInvoices.length > 0)
{
for(MMatchInv matchInvoice : matchInvoices)
{
if (!matchInvoice.isPosted())
{
addDocsPostProcess(matchInvoice);
}
}
}
}
}
}

View File

@ -48,6 +48,7 @@ import org.compiere.model.PO;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Util;
import org.eevolution.model.I_DD_Order;
import org.eevolution.model.I_HR_Process;
@ -235,11 +236,13 @@ public class DocumentEngine implements DocAction
if (docPO.get_ID() > 0 && docPO.get_TrxName() != null && docPO.get_ValueOld("DocStatus") != null) {
DB.getDatabase().forUpdate(docPO, 30);
String docStatusOriginal = (String) docPO.get_ValueOld("DocStatus");
String currentStatus = DB.getSQLValueString((String)null,
"SELECT DocStatus FROM " + docPO.get_TableName() + " WHERE " + docPO.get_KeyColumns()[0] + " = ? ",
docPO.get_ID());
String statusSql = "SELECT DocStatus FROM " + docPO.get_TableName() + " WHERE " + docPO.get_KeyColumns()[0] + " = ? ";
String currentStatus = DB.getSQLValueString((String)null, statusSql, docPO.get_ID());
if (!docStatusOriginal.equals(currentStatus) && currentStatus != null) {
throw new IllegalStateException("Document status have been change by other session, please refresh your window and try again. " + docPO.toString());
currentStatus = DB.getSQLValueString(docPO.get_TrxName(), statusSql, docPO.get_ID());
if (!docStatusOriginal.equals(currentStatus)) {
throw new IllegalStateException(Msg.getMsg(docPO.getCtx(), "DocStatusChanged") + " " + docPO.toString());
}
}
}
}

View File

@ -357,6 +357,12 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
}
private void setValueAndClose() {
String statusSql = "SELECT DocStatus FROM " + gridTab.getTableName()
+ " WHERE " + gridTab.getKeyColumnName() + " = ? ";
String currentStatus = DB.getSQLValueString((String)null, statusSql, gridTab.getKeyID(gridTab.getCurrentRow()));
if (DocStatus != null && !DocStatus.equals(currentStatus)) {
throw new IllegalStateException(Msg.getMsg(Env.getCtx(), "DocStatusChanged"));
}
m_OKpressed = true;
setValue();
detach();