details:   https://code.openbravo.com/erp/devel/pi/rev/07f0f908a7eb
changeset: 25908:07f0f908a7eb
user:      Reinaldo Guerra <reinaldo.guerra <at> peoplewalking.com>
date:      Tue Feb 10 21:06:42 2015 -0500
summary:   Fixed bug 28775: "Order quantity" incorrectly set for several 
requisition lines.

Requisition to order process was also changed to accumulate order quantity 
field registered on each requisition's lines processed.
Now not just is calculated total lock quantity, but also order's quantity for 
all processed requisition lines, so "Order quantity" is registered successfuly 
in created purchase order.

details:   https://code.openbravo.com/erp/devel/pi/rev/915ce7c4d04e
changeset: 25909:915ce7c4d04e
user:      Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
date:      Wed Feb 11 18:46:00 2015 +0100
summary:   Fixes issue 28762: bpartner not setted in transaction

aprm_gen_paymentschedule_inv has been modified to include invoice's bussines 
partner when creating automatically the transaction in the financial account

diffstat:

 
modules/org.openbravo.advpaymentmngt/src-db/database/model/functions/APRM_GEN_PAYMENTSCHEDULE_INV.xml
 |  10 ++--
 src/org/openbravo/erpCommon/ad_forms/RequisitionToOrder.java                   
                       |  17 +++++++--
 2 files changed, 18 insertions(+), 9 deletions(-)

diffs (108 lines):

diff -r 3cf79f7adef9 -r 915ce7c4d04e 
modules/org.openbravo.advpaymentmngt/src-db/database/model/functions/APRM_GEN_PAYMENTSCHEDULE_INV.xml
--- 
a/modules/org.openbravo.advpaymentmngt/src-db/database/model/functions/APRM_GEN_PAYMENTSCHEDULE_INV.xml
     Thu Feb 12 18:43:18 2015 +0100
+++ 
b/modules/org.openbravo.advpaymentmngt/src-db/database/model/functions/APRM_GEN_PAYMENTSCHEDULE_INV.xml
     Wed Feb 11 18:46:00 2015 +0100
@@ -16,7 +16,7 @@
 * under the License.
 * The Original Code is Openbravo ERP.
 * The Initial Developer of the Original Code is Openbravo SLU
-* All portions are Copyright (C) 2010-2014 Openbravo SLU
+* All portions are Copyright (C) 2010-2015 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
@@ -1007,13 +1007,13 @@
                     line, fin_payment_id, dateacct, c_glitem_id, status, 
paymentamt,
                     depositamt, processed, processing, posted, c_project_id, 
c_campaign_id, c_costcenter_id,
                     c_activity_id, user1_id, user2_id, trxtype, statementdate, 
description,
-                    fin_reconciliation_id, foreign_currency_id, 
foreign_convert_rate, foreign_amount)
+                    fin_reconciliation_id, foreign_currency_id, 
foreign_convert_rate, foreign_amount, c_bpartner_id)
                   VALUES (v_FIN_FINACC_TRANSACTION_ID, v_client_id, 
cur_paymentschedule.AD_ORG_ID, now(), p_user,
                     now(), p_user, 'Y', v_finacct_currency, 
v_Financial_Account_ID,
                     v_Line, v_FIN_PAYMENT_ID, cur_paymentschedule.DUEDATE, 
NULL, CASE WHEN v_IsSOTrx='Y' THEN 'RDNC' ELSE 'PWNC' END, CASE WHEN 
v_IsSOTrx='N' THEN ROUND(cur_paymentschedule.OUTSTANDINGAMT*v_rate, v_PricePr) 
ELSE 0 END,
                     CASE WHEN v_IsSOTrx='Y' THEN 
ROUND(cur_paymentschedule.OUTSTANDINGAMT*v_rate, v_PricePr) ELSE 0 END, 'Y', 
'N', 'N', v_project_id, v_campaign_id, v_costcenter,
                     v_activity_id, v_user1, v_user2, CASE WHEN v_IsSOTrx='N' 
THEN 'BPW' ELSE 'BPD' END, cur_paymentschedule.DUEDATE, 'Invoice No.: ' || 
v_documentno,
-                    NULL, cur_paymentschedule.C_CURRENCY_ID, v_rate , CASE 
WHEN v_IsSOTrx='N' THEN cur_paymentschedule.OUTSTANDINGAMT ELSE 
cur_paymentschedule.OUTSTANDINGAMT END);
+                    NULL, cur_paymentschedule.C_CURRENCY_ID, v_rate , CASE 
WHEN v_IsSOTrx='N' THEN cur_paymentschedule.OUTSTANDINGAMT ELSE 
cur_paymentschedule.OUTSTANDINGAMT END, v_BPartner_ID);
                 ELSE
                   INSERT INTO fin_finacc_transaction(
                     fin_finacc_transaction_id, ad_client_id, ad_org_id, 
created,
@@ -1021,13 +1021,13 @@
                     line, fin_payment_id, dateacct, c_glitem_id, status, 
paymentamt,
                     depositamt, processed, processing, posted, c_project_id, 
c_campaign_id, c_costcenter_id,
                     c_activity_id, user1_id, user2_id, trxtype, statementdate, 
description,
-                    fin_reconciliation_id)
+                    fin_reconciliation_id, c_bpartner_id)
                   VALUES (v_FIN_FINACC_TRANSACTION_ID, v_client_id, 
cur_paymentschedule.AD_ORG_ID, now(), p_user,
                     now(), p_user, 'Y', cur_paymentschedule.C_CURRENCY_ID, 
v_Financial_Account_ID,
                     v_Line, v_FIN_PAYMENT_ID, cur_paymentschedule.DUEDATE, 
NULL, CASE WHEN v_IsSOTrx='Y' THEN 'RDNC' ELSE 'PWNC' END, CASE WHEN 
v_IsSOTrx='N' THEN cur_paymentschedule.OUTSTANDINGAMT ELSE 0 END,
                     CASE WHEN v_IsSOTrx='Y' THEN 
cur_paymentschedule.OUTSTANDINGAMT ELSE 0 END, 'Y', 'N', 'N', v_project_id, 
v_campaign_id, v_costcenter,
                     v_activity_id, v_user1, v_user2, CASE WHEN v_IsSOTrx='N' 
THEN 'BPW' ELSE 'BPD' END, cur_paymentschedule.DUEDATE, 'Invoice No.: ' || 
v_documentno,
-                    NULL);
+                    NULL, v_BPartner_ID);
                 END IF;
                 
                 
diff -r 3cf79f7adef9 -r 915ce7c4d04e 
src/org/openbravo/erpCommon/ad_forms/RequisitionToOrder.java
--- a/src/org/openbravo/erpCommon/ad_forms/RequisitionToOrder.java      Thu Feb 
12 18:43:18 2015 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/RequisitionToOrder.java      Wed Feb 
11 18:46:00 2015 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2008-2012 Openbravo SLU 
+ * All portions are Copyright (C) 2008-2015 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -517,6 +517,8 @@
       String strCOrderlineID = "";
       BigDecimal qty = new BigDecimal("0");
       BigDecimal qtyOrder = new BigDecimal("0");
+      BigDecimal quantity = new BigDecimal("0");
+      BigDecimal quantityOrder = new BigDecimal("0");
       boolean insertLine = false;
 
       RequisitionToOrderData[] lines = RequisitionToOrderData.linesToOrder(
@@ -545,6 +547,7 @@
         if (i == lines.length - 1) {
           insertLine = true;
           qtyOrder = qty;
+          quantityOrder = quantity;
         } else if (!lines[i + 1].mProductId.equals(lines[i].mProductId)
             || !lines[i + 
1].mAttributesetinstanceId.equals(lines[i].mAttributesetinstanceId)
             || !lines[i + 1].description.equals(lines[i].description)
@@ -552,8 +555,11 @@
           insertLine = true;
           qtyOrder = qty;
           qty = new BigDecimal(0);
+          quantityOrder = quantity;
+          quantity = new BigDecimal(0);
         } else {
           qty = qty.add(new BigDecimal(lines[i].lockqty));
+          quantity = quantity.add(new BigDecimal(lines[i].quantityorder));
         }
         lines[i].cOrderlineId = strCOrderlineID;
         if (insertLine) {
@@ -561,6 +567,8 @@
           line += 10;
           BigDecimal qtyAux = new BigDecimal(lines[i].lockqty);
           qtyOrder = qtyOrder.add(qtyAux);
+          BigDecimal quantityAux = new BigDecimal(lines[i].quantityorder);
+          quantityOrder = quantityOrder.add(quantityAux);
           if (log4j.isDebugEnabled())
             log4j.debug("Lockqty: " + lines[i].lockqty + " qtyorder: " + 
qtyOrder.toPlainString()
                 + " new BigDecimal: " + (new 
BigDecimal(lines[i].lockqty)).toString() + " qtyAux: "
@@ -572,9 +580,10 @@
                 RequisitionToOrderData.cBPartnerLocationId(this, strVendor), 
strOrderDate,
                 lines[i].needbydate, lines[i].description, lines[i].mProductId,
                 lines[i].mAttributesetinstanceId, strWarehouse, 
lines[i].mProductUomId,
-                lines[i].cUomId, lines[i].quantityorder, 
qtyOrder.toPlainString(), cCurrencyId,
-                lines[i].pricelist, lines[i].priceactual, strPriceListId, 
lines[i].pricelimit,
-                lines[i].tax, "", lines[i].discount, lines[i].grossUnit, 
lines[i].grossAmt);
+                lines[i].cUomId, quantityOrder.toPlainString(), 
qtyOrder.toPlainString(),
+                cCurrencyId, lines[i].pricelist, lines[i].priceactual, 
strPriceListId,
+                lines[i].pricelimit, lines[i].tax, "", lines[i].discount, 
lines[i].grossUnit,
+                lines[i].grossAmt);
           } catch (ServletException ex) {
             myMessage = Utility.translateError(this, vars, vars.getLanguage(), 
ex.getMessage());
             releaseRollbackConnection(conn);

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to