IDEMPIERE-448 Add CopyFrom on Bank Statement / fix problem copying lines without charges - throwing error about Charge is mandatory

This commit is contained in:
Carlos Ruiz 2015-01-05 18:33:53 -05:00
parent 8eb5a01501
commit fef106746a
3 changed files with 34 additions and 7 deletions

View File

@ -0,0 +1,15 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Jan 5, 2015 6:14:51 PM COT
-- IDEMPIERE-448 Add CopyFrom on Bank Statement
UPDATE AD_Column SET IsMandatory='N',Updated=TO_DATE('2015-01-05 18:14:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4939
;
-- Jan 5, 2015 6:14:59 PM COT
UPDATE AD_Field SET IsMandatory='Y',Updated=TO_DATE('2015-01-05 18:14:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4009
;
SELECT register_migration_script('201501051826_IDEMPIERE-448.sql') FROM dual
;

View File

@ -0,0 +1,12 @@
-- Jan 5, 2015 6:14:51 PM COT
-- IDEMPIERE-448 Add CopyFrom on Bank Statement
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2015-01-05 18:14:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4939
;
-- Jan 5, 2015 6:14:59 PM COT
UPDATE AD_Field SET IsMandatory='Y',Updated=TO_TIMESTAMP('2015-01-05 18:14:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4009
;
SELECT register_migration_script('201501051826_IDEMPIERE-448.sql') FROM dual
;

View File

@ -166,6 +166,13 @@ import org.compiere.util.Msg;
log.saveError("ParentComplete", Msg.translate(getCtx(), "C_BankStatementLine")); log.saveError("ParentComplete", Msg.translate(getCtx(), "C_BankStatementLine"));
return false; return false;
} }
// Calculate Charge = Statement - trx - Interest
BigDecimal amt = getStmtAmt();
amt = amt.subtract(getTrxAmt());
amt = amt.subtract(getInterestAmt());
if (amt.compareTo(getChargeAmt()) != 0)
setChargeAmt (amt);
//
if (getChargeAmt().signum() != 0 && getC_Charge_ID() == 0) if (getChargeAmt().signum() != 0 && getC_Charge_ID() == 0)
{ {
log.saveError("FillMandatory", Msg.getElement(getCtx(), "C_Charge_ID")); log.saveError("FillMandatory", Msg.getElement(getCtx(), "C_Charge_ID"));
@ -199,13 +206,6 @@ import org.compiere.util.Msg;
setC_BPartner_ID(invoice.getC_BPartner_ID()); setC_BPartner_ID(invoice.getC_BPartner_ID());
} }
// Calculate Charge = Statement - trx - Interest
BigDecimal amt = getStmtAmt();
amt = amt.subtract(getTrxAmt());
amt = amt.subtract(getInterestAmt());
if (amt.compareTo(getChargeAmt()) != 0)
setChargeAmt (amt);
//
return true; return true;
} // beforeSave } // beforeSave