Fix several errors with Allocation:

- fix a wrong raise of exception when no organization (add throws keyword)
- when creating the allocation is taking the organization of log in, and it must take precedence the organization chosen by the user on the allocation window (login org still used in case no org is selected by user)
This commit is contained in:
Carlos Ruiz 2011-03-08 11:45:59 -05:00
parent 52ccb1f03c
commit 9bc32c1cd4
3 changed files with 9 additions and 1 deletions

View File

@ -424,6 +424,10 @@ public class VAllocation extends Allocation
*/
public void saveData()
{
if (m_AD_Org_ID > 0)
Env.setContext(Env.getCtx(), m_WindowNo, "AD_Org_ID", m_AD_Org_ID);
else
Env.setContext(Env.getCtx(), m_WindowNo, "AD_Org_ID", "");
try
{
Trx.run(new TrxRunnable()

View File

@ -486,6 +486,10 @@ public class WAllocation extends Allocation
*/
public void saveData()
{
if (m_AD_Org_ID > 0)
Env.setContext(Env.getCtx(), form.getWindowNo(), "AD_Org_ID", m_AD_Org_ID);
else
Env.setContext(Env.getCtx(), form.getWindowNo(), "AD_Org_ID", "");
Trx trx = Trx.get(Trx.createTrxName("AL"), true);
statusBar.setStatusLine(saveData(form.getWindowNo(), dateField.getValue(), paymentTable, invoiceTable, trx.getTrxName()));
trx.commit();

View File

@ -604,7 +604,7 @@ public class Allocation
if (AD_Org_ID == 0)
{
//ADialog.error(m_WindowNo, this, "Org0NotAllowed", null);
new AdempiereException("@Org0NotAllowed@");
throw new AdempiereException("@Org0NotAllowed@");
}
//
log.config("Client=" + AD_Client_ID + ", Org=" + AD_Org_ID