details: https://code.openbravo.com/erp/devel/pi/rev/47a20feae056
changeset: 20711:47a20feae056
user: Ioritz Cia <ioritz.cia <at> openbravo.com>
date: Mon Jul 08 10:16:59 2013 +0200
summary: Related to issue 24038: Prepayment against invoice with different
conversion rates.
diffstat:
src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java | 19 ++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
diffs (43 lines):
diff -r cba285f50e81 -r 47a20feae056
src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java
--- a/src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java Fri Jul 05
21:13:30 2013 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java Mon Jul 08
10:16:59 2013 +0200
@@ -27,6 +27,7 @@
import javax.servlet.ServletException;
import org.apache.log4j.Logger;
+import org.hibernate.Query;
import org.hibernate.criterion.Restrictions;
import org.openbravo.advpaymentmngt.utility.FIN_Utility;
import org.openbravo.base.secureApp.VariablesSecureApp;
@@ -334,7 +335,7 @@
String bpAmountConverted = bpAmount;
Invoice invoice = line.getInvoice();
String strcCurrencyId = C_Currency_ID;
- if (invoice != null) {
+ if (!isOrderPrepayment(line.getLine_ID()) && invoice != null) {
// To force opposite posting isReceipt is opposite as well. this
is required when
// looking backwards
bpAmountConverted = convertAmount(new BigDecimal(bpAmount),
!isReceipt, DateAcct,
@@ -465,6 +466,22 @@
return fact;
}
+ public boolean isOrderPrepayment(String paymentDetailID) {
+ StringBuilder hql = new StringBuilder();
+ hql.append("select pd ");
+ hql.append("from FIN_Payment_Detail pd ");
+ hql.append(" where pd.id = '" + paymentDetailID + "' ");
+
+ final Query obqPD =
OBDal.getInstance().getSession().createQuery(hql.toString());
+
+ List<FIN_PaymentDetail> paymentDetailList = obqPD.list();
+ if (paymentDetailList.size() > 0) {
+ return paymentDetailList.get(0).isPrepayment();
+ } else {
+ return false;
+ }
+ }
+
public String nextSeqNo(String oldSeqNo) {
BigDecimal seqNo = new BigDecimal(oldSeqNo);
SeqNo = (seqNo.add(new BigDecimal("10"))).toString();
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits