IDEMPIERE-1927 MAccount.get creating deadlocks because it doesn't have trx
This commit is contained in:
parent
448b84f284
commit
9f24e8a85b
|
@ -228,7 +228,8 @@ public class AcctSchemaCopyAcct extends SvrProcess
|
||||||
M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID,
|
M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID,
|
||||||
C_LocFrom_ID, C_LocTo_ID, C_SalesRegion_ID,
|
C_LocFrom_ID, C_LocTo_ID, C_SalesRegion_ID,
|
||||||
C_Project_ID, C_Campaign_ID, C_Activity_ID,
|
C_Project_ID, C_Campaign_ID, C_Activity_ID,
|
||||||
User1_ID, User2_ID, UserElement1_ID, UserElement2_ID);
|
User1_ID, User2_ID, UserElement1_ID, UserElement2_ID,
|
||||||
|
get_TrxName());
|
||||||
} // createAccount
|
} // createAccount
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -786,7 +786,8 @@ public class ImportGLJournal extends SvrProcess
|
||||||
imp.getM_Product_ID(), imp.getC_BPartner_ID(), imp.getAD_OrgTrx_ID(),
|
imp.getM_Product_ID(), imp.getC_BPartner_ID(), imp.getAD_OrgTrx_ID(),
|
||||||
imp.getC_LocFrom_ID(), imp.getC_LocTo_ID(), imp.getC_SalesRegion_ID(),
|
imp.getC_LocFrom_ID(), imp.getC_LocTo_ID(), imp.getC_SalesRegion_ID(),
|
||||||
imp.getC_Project_ID(), imp.getC_Campaign_ID(), imp.getC_Activity_ID(),
|
imp.getC_Project_ID(), imp.getC_Campaign_ID(), imp.getC_Activity_ID(),
|
||||||
imp.getUser1_ID(), imp.getUser2_ID(), 0, 0);
|
imp.getUser1_ID(), imp.getUser2_ID(), 0, 0,
|
||||||
|
get_TrxName());
|
||||||
if (acct != null && acct.get_ID() == 0)
|
if (acct != null && acct.get_ID() == 0)
|
||||||
acct.saveEx();
|
acct.saveEx();
|
||||||
if (acct == null || acct.get_ID() == 0)
|
if (acct == null || acct.get_ID() == 0)
|
||||||
|
|
|
@ -333,7 +333,8 @@ public class InvoiceNGL extends SvrProcess
|
||||||
base.getM_Product_ID(), base.getC_BPartner_ID(), base.getAD_OrgTrx_ID(),
|
base.getM_Product_ID(), base.getC_BPartner_ID(), base.getAD_OrgTrx_ID(),
|
||||||
base.getC_LocFrom_ID(), base.getC_LocTo_ID(), base.getC_SalesRegion_ID(),
|
base.getC_LocFrom_ID(), base.getC_LocTo_ID(), base.getC_SalesRegion_ID(),
|
||||||
base.getC_Project_ID(), base.getC_Campaign_ID(), base.getC_Activity_ID(),
|
base.getC_Project_ID(), base.getC_Campaign_ID(), base.getC_Activity_ID(),
|
||||||
base.getUser1_ID(), base.getUser2_ID(), base.getUserElement1_ID(), base.getUserElement2_ID());
|
base.getUser1_ID(), base.getUser2_ID(), base.getUserElement1_ID(), base.getUserElement2_ID(),
|
||||||
|
get_TrxName());
|
||||||
line.setDescription(Msg.getElement(getCtx(), "UnrealizedGain_Acct"));
|
line.setDescription(Msg.getElement(getCtx(), "UnrealizedGain_Acct"));
|
||||||
line.setC_ValidCombination_ID(acct.getC_ValidCombination_ID());
|
line.setC_ValidCombination_ID(acct.getC_ValidCombination_ID());
|
||||||
line.setAmtSourceCr (drTotal);
|
line.setAmtSourceCr (drTotal);
|
||||||
|
@ -351,7 +352,8 @@ public class InvoiceNGL extends SvrProcess
|
||||||
base.getM_Product_ID(), base.getC_BPartner_ID(), base.getAD_OrgTrx_ID(),
|
base.getM_Product_ID(), base.getC_BPartner_ID(), base.getAD_OrgTrx_ID(),
|
||||||
base.getC_LocFrom_ID(), base.getC_LocTo_ID(), base.getC_SalesRegion_ID(),
|
base.getC_LocFrom_ID(), base.getC_LocTo_ID(), base.getC_SalesRegion_ID(),
|
||||||
base.getC_Project_ID(), base.getC_Campaign_ID(), base.getC_Activity_ID(),
|
base.getC_Project_ID(), base.getC_Campaign_ID(), base.getC_Activity_ID(),
|
||||||
base.getUser1_ID(), base.getUser2_ID(), base.getUserElement1_ID(), base.getUserElement2_ID());
|
base.getUser1_ID(), base.getUser2_ID(), base.getUserElement1_ID(), base.getUserElement2_ID(),
|
||||||
|
get_TrxName());
|
||||||
line.setDescription(Msg.getElement(getCtx(), "UnrealizedLoss_Acct"));
|
line.setDescription(Msg.getElement(getCtx(), "UnrealizedLoss_Acct"));
|
||||||
line.setC_ValidCombination_ID(acct.getC_ValidCombination_ID());
|
line.setC_ValidCombination_ID(acct.getC_ValidCombination_ID());
|
||||||
line.setAmtSourceDr (crTotal);
|
line.setAmtSourceDr (crTotal);
|
||||||
|
|
|
@ -991,7 +991,8 @@ public final class FactLine extends X_Fact_Acct
|
||||||
AD_Client_ID, AD_Org_ID, getC_AcctSchema_ID(), Account_ID, C_SubAcct_ID,
|
AD_Client_ID, AD_Org_ID, getC_AcctSchema_ID(), Account_ID, C_SubAcct_ID,
|
||||||
M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID, C_LocFrom_ID, C_LocTo_ID, C_SRegion_ID,
|
M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID, C_LocFrom_ID, C_LocTo_ID, C_SRegion_ID,
|
||||||
C_Project_ID, C_Campaign_ID, C_Activity_ID,
|
C_Project_ID, C_Campaign_ID, C_Activity_ID,
|
||||||
User1_ID, User2_ID, UserElement1_ID, UserElement2_ID);
|
User1_ID, User2_ID, UserElement1_ID, UserElement2_ID,
|
||||||
|
get_TrxName());
|
||||||
if (revenue != null && revenue.get_ID() == 0)
|
if (revenue != null && revenue.get_ID() == 0)
|
||||||
revenue.saveEx();
|
revenue.saveEx();
|
||||||
if (revenue == null || revenue.get_ID() == 0)
|
if (revenue == null || revenue.get_ID() == 0)
|
||||||
|
|
|
@ -41,7 +41,27 @@ public class MAccount extends X_C_ValidCombination
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -1936396369349550834L;
|
private static final long serialVersionUID = 7980515458720808532L;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Deprecated - use the same method with trxName instead
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static MAccount get(Properties ctx, int ad_Client_ID, int ad_Org_ID,
|
||||||
|
int c_AcctSchema_ID, int new_account_id, int c_SubAcct_ID,
|
||||||
|
int m_Product_ID, int c_BPartner_ID, int ad_OrgTrx_ID,
|
||||||
|
int c_LocFrom_ID, int c_LocTo_ID, int c_SalesRegion_ID,
|
||||||
|
int c_Project_ID, int c_Campaign_ID, int c_Activity_ID,
|
||||||
|
int user1_ID, int user2_ID, int userElement1_ID,
|
||||||
|
int userElement2_ID) {
|
||||||
|
return get(ctx, ad_Client_ID, ad_Org_ID,
|
||||||
|
c_AcctSchema_ID, new_account_id, c_SubAcct_ID,
|
||||||
|
m_Product_ID, c_BPartner_ID, ad_OrgTrx_ID,
|
||||||
|
c_LocFrom_ID, c_LocTo_ID, c_SalesRegion_ID,
|
||||||
|
c_Project_ID, c_Campaign_ID, c_Activity_ID,
|
||||||
|
user1_ID, user2_ID, userElement1_ID,
|
||||||
|
userElement2_ID, null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get existing Account or create it
|
* Get existing Account or create it
|
||||||
|
@ -64,6 +84,7 @@ public class MAccount extends X_C_ValidCombination
|
||||||
* @param User2_ID
|
* @param User2_ID
|
||||||
* @param UserElement1_ID
|
* @param UserElement1_ID
|
||||||
* @param UserElement2_ID
|
* @param UserElement2_ID
|
||||||
|
* @param trxName
|
||||||
* @return account or null
|
* @return account or null
|
||||||
*/
|
*/
|
||||||
public static MAccount get (Properties ctx,
|
public static MAccount get (Properties ctx,
|
||||||
|
@ -72,7 +93,8 @@ public class MAccount extends X_C_ValidCombination
|
||||||
int M_Product_ID, int C_BPartner_ID, int AD_OrgTrx_ID,
|
int M_Product_ID, int C_BPartner_ID, int AD_OrgTrx_ID,
|
||||||
int C_LocFrom_ID, int C_LocTo_ID, int C_SalesRegion_ID,
|
int C_LocFrom_ID, int C_LocTo_ID, int C_SalesRegion_ID,
|
||||||
int C_Project_ID, int C_Campaign_ID, int C_Activity_ID,
|
int C_Project_ID, int C_Campaign_ID, int C_Activity_ID,
|
||||||
int User1_ID, int User2_ID, int UserElement1_ID, int UserElement2_ID)
|
int User1_ID, int User2_ID, int UserElement1_ID, int UserElement2_ID,
|
||||||
|
String trxName)
|
||||||
{
|
{
|
||||||
StringBuilder info = new StringBuilder();
|
StringBuilder info = new StringBuilder();
|
||||||
info.append("AD_Client_ID=").append(AD_Client_ID).append(",AD_Org_ID=").append(AD_Org_ID);
|
info.append("AD_Client_ID=").append(AD_Client_ID).append(",AD_Org_ID=").append(AD_Org_ID);
|
||||||
|
@ -192,7 +214,7 @@ public class MAccount extends X_C_ValidCombination
|
||||||
}
|
}
|
||||||
// whereClause.append(" ORDER BY IsFullyQualified DESC");
|
// whereClause.append(" ORDER BY IsFullyQualified DESC");
|
||||||
|
|
||||||
MAccount existingAccount = new Query(ctx, MAccount.Table_Name, whereClause.toString(), null)
|
MAccount existingAccount = new Query(ctx, MAccount.Table_Name, whereClause.toString(), trxName)
|
||||||
.setParameters(params)
|
.setParameters(params)
|
||||||
.setOnlyActiveRecords(true)
|
.setOnlyActiveRecords(true)
|
||||||
.firstOnly();
|
.firstOnly();
|
||||||
|
@ -202,7 +224,7 @@ public class MAccount extends X_C_ValidCombination
|
||||||
return existingAccount;
|
return existingAccount;
|
||||||
|
|
||||||
// New
|
// New
|
||||||
MAccount newAccount = new MAccount (ctx, 0, null);
|
MAccount newAccount = new MAccount (ctx, 0, trxName);
|
||||||
newAccount.setClientOrg(AD_Client_ID, AD_Org_ID);
|
newAccount.setClientOrg(AD_Client_ID, AD_Org_ID);
|
||||||
newAccount.setC_AcctSchema_ID(C_AcctSchema_ID);
|
newAccount.setC_AcctSchema_ID(C_AcctSchema_ID);
|
||||||
newAccount.setAccount_ID(Account_ID);
|
newAccount.setAccount_ID(Account_ID);
|
||||||
|
|
|
@ -143,7 +143,8 @@ public class MDistributionLine extends X_GL_DistributionLine
|
||||||
isOverwriteUser1() ? getUser1_ID() : m_account.getUser1_ID(),
|
isOverwriteUser1() ? getUser1_ID() : m_account.getUser1_ID(),
|
||||||
isOverwriteUser2() ? getUser2_ID() : m_account.getUser2_ID(),
|
isOverwriteUser2() ? getUser2_ID() : m_account.getUser2_ID(),
|
||||||
m_account.getUserElement1_ID(),
|
m_account.getUserElement1_ID(),
|
||||||
m_account.getUserElement2_ID());
|
m_account.getUserElement2_ID(),
|
||||||
|
get_TrxName());
|
||||||
return acct;
|
return acct;
|
||||||
} // setAccount
|
} // setAccount
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,8 @@ public class MFactAcct extends X_Fact_Acct
|
||||||
getM_Product_ID(), getC_BPartner_ID(), getAD_OrgTrx_ID(),
|
getM_Product_ID(), getC_BPartner_ID(), getAD_OrgTrx_ID(),
|
||||||
getC_LocFrom_ID(), getC_LocTo_ID(), getC_SalesRegion_ID(),
|
getC_LocFrom_ID(), getC_LocTo_ID(), getC_SalesRegion_ID(),
|
||||||
getC_Project_ID(), getC_Campaign_ID(), getC_Activity_ID(),
|
getC_Project_ID(), getC_Campaign_ID(), getC_Activity_ID(),
|
||||||
getUser1_ID(), getUser2_ID(), getUserElement1_ID(), getUserElement2_ID());
|
getUser1_ID(), getUser2_ID(), getUserElement1_ID(), getUserElement2_ID(),
|
||||||
|
get_TrxName());
|
||||||
if (acct != null && acct.get_ID() == 0)
|
if (acct != null && acct.get_ID() == 0)
|
||||||
acct.saveEx();
|
acct.saveEx();
|
||||||
return acct;
|
return acct;
|
||||||
|
|
|
@ -441,7 +441,8 @@ public class MJournalLine extends X_GL_JournalLine
|
||||||
MAccount acct = MAccount.get(getCtx(), getAD_Client_ID(), getAD_Org_ID(), gl.getC_AcctSchema_ID(), getAccount_ID(),
|
MAccount acct = MAccount.get(getCtx(), getAD_Client_ID(), getAD_Org_ID(), gl.getC_AcctSchema_ID(), getAccount_ID(),
|
||||||
getC_SubAcct_ID(), getM_Product_ID(), getC_BPartner_ID(), getAD_OrgTrx_ID(), getC_LocFrom_ID(),
|
getC_SubAcct_ID(), getM_Product_ID(), getC_BPartner_ID(), getAD_OrgTrx_ID(), getC_LocFrom_ID(),
|
||||||
getC_LocTo_ID(), getC_SalesRegion_ID(), getC_Project_ID(), getC_Campaign_ID(),
|
getC_LocTo_ID(), getC_SalesRegion_ID(), getC_Project_ID(), getC_Campaign_ID(),
|
||||||
getC_Activity_ID(), getUser1_ID(), getUser2_ID(), 0, 0);
|
getC_Activity_ID(), getUser1_ID(), getUser2_ID(), 0, 0,
|
||||||
|
get_TrxName());
|
||||||
|
|
||||||
if (acct != null)
|
if (acct != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -503,7 +503,8 @@ public class GLJournalGenerate extends SvrProcess
|
||||||
AD_OrgTrx_ID, C_LocFrom_ID, C_LocTo_ID,
|
AD_OrgTrx_ID, C_LocFrom_ID, C_LocTo_ID,
|
||||||
C_SalesRegion_ID, C_Project_ID, C_Campaign_ID,
|
C_SalesRegion_ID, C_Project_ID, C_Campaign_ID,
|
||||||
C_Activity_ID, User1_ID, User2_ID, UserElement1_ID,
|
C_Activity_ID, User1_ID, User2_ID, UserElement1_ID,
|
||||||
UserElement2_ID);
|
UserElement2_ID,
|
||||||
|
get_TrxName());
|
||||||
if (combination == null)
|
if (combination == null)
|
||||||
throw new AdempiereException("Could not create combination");
|
throw new AdempiereException("Could not create combination");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1044,7 +1044,7 @@ public final class VAccountDialog extends CDialog
|
||||||
M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID,
|
M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID,
|
||||||
C_LocFrom_ID, C_LocTo_ID, C_SRegion_ID,
|
C_LocFrom_ID, C_LocTo_ID, C_SRegion_ID,
|
||||||
C_Project_ID, C_Campaign_ID, C_Activity_ID,
|
C_Project_ID, C_Campaign_ID, C_Activity_ID,
|
||||||
User1_ID, User2_ID, 0, 0);
|
User1_ID, User2_ID, 0, 0, null);
|
||||||
if (acct != null && acct.get_ID() == 0)
|
if (acct != null && acct.get_ID() == 0)
|
||||||
acct.saveEx();
|
acct.saveEx();
|
||||||
|
|
||||||
|
|
|
@ -1037,7 +1037,7 @@ public final class WAccountDialog extends Window
|
||||||
M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID,
|
M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID,
|
||||||
C_LocFrom_ID, C_LocTo_ID, C_SRegion_ID,
|
C_LocFrom_ID, C_LocTo_ID, C_SRegion_ID,
|
||||||
C_Project_ID, C_Campaign_ID, C_Activity_ID,
|
C_Project_ID, C_Campaign_ID, C_Activity_ID,
|
||||||
User1_ID, User2_ID, 0, 0);
|
User1_ID, User2_ID, 0, 0, null);
|
||||||
if (acct != null && acct.get_ID() == 0)
|
if (acct != null && acct.get_ID() == 0)
|
||||||
acct.saveEx();
|
acct.saveEx();
|
||||||
|
|
||||||
|
|
|
@ -362,7 +362,8 @@ public class Charge
|
||||||
defaultAccount.getUser1_ID(),
|
defaultAccount.getUser1_ID(),
|
||||||
defaultAccount.getUser2_ID(),
|
defaultAccount.getUser2_ID(),
|
||||||
defaultAccount.getUserElement1_ID(),
|
defaultAccount.getUserElement1_ID(),
|
||||||
defaultAccount.getUserElement2_ID());
|
defaultAccount.getUserElement2_ID(),
|
||||||
|
null);
|
||||||
|
|
||||||
return account;
|
return account;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue