details:   https://code.openbravo.com/erp/devel/pi/rev/bc03ed72e085
changeset: 13989:bc03ed72e085
user:      Mikel Irurita <mikel.irurita <at> openbravo.com>
date:      Fri Oct 14 10:37:06 2011 +0200
summary:   Fixes issue 18708: posting Invoice (no product in lines) issue.
Posting Invoice without product, without account and without default product 
category should use AcctSchema Defaults.
selectDefaultAcct method has changed the logic behing. Before it returned the 
accounts of the product category
marked as default, if no product category is marked as default, returned the 
accoutns of the oldest product
category.
Now, it returns the accounts configured in accounting schema defaults. If one 
of the default accounts are not
filled in (some of then are not mandatory) it will search in the product 
category marked as default, if not
in the oldest product category.

diffstat:

 src/org/openbravo/erpCommon/ad_forms/ProductInfo.java      |   6 +++-
 src/org/openbravo/erpCommon/ad_forms/ProductInfo_data.xsql |  18 ++++++++-----
 2 files changed, 15 insertions(+), 9 deletions(-)

diffs (51 lines):

diff -r 6e4192b18a24 -r bc03ed72e085 
src/org/openbravo/erpCommon/ad_forms/ProductInfo.java
--- a/src/org/openbravo/erpCommon/ad_forms/ProductInfo.java     Fri Oct 14 
10:13:41 2011 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/ProductInfo.java     Fri Oct 14 
10:37:06 2011 +0200
@@ -86,7 +86,8 @@
   public Account getAccount(String AcctType, AcctSchema as, ConnectionProvider 
conn) {
     if (Integer.parseInt(AcctType) < 1 || Integer.parseInt(AcctType) > 8)
       return null;
-    // No Product - get Default from Product Category
+    // No Product - get Default from Accounting Schema defaults then from 
default Product Category
+    // and finally from oldest Product Category
     if (m_M_Product_ID.equals(""))
       return getAccountDefault(AcctType, as, conn);
     ProductInfoData[] data = null;
@@ -132,7 +133,8 @@
   } // getAccount
 
   /**
-   * Account from Default Product Category
+   * Account from Accounting Schema defaults, then from default Product 
Category and finally from
+   * oldest Product Category
    * 
    * @param AcctType
    *          see ACCTTYPE_* (1..8)
diff -r 6e4192b18a24 -r bc03ed72e085 
src/org/openbravo/erpCommon/ad_forms/ProductInfo_data.xsql
--- a/src/org/openbravo/erpCommon/ad_forms/ProductInfo_data.xsql        Fri Oct 
14 10:13:41 2011 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/ProductInfo_data.xsql        Fri Oct 
14 10:37:06 2011 +0200
@@ -56,13 +56,17 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-  SELECT P_Revenue_Acct as revenue, P_Expense_Acct as expense, P_Asset_Acct as 
asset, P_Cogs_Acct as cogs, 
-  P_PurchasePriceVariance_Acct as purchasepricevariance, 
P_InvoicePriceVariance_Acct as invoicepricevariance, 
-  P_TradeDiscountRec_Acct as discountrec, P_TradeDiscountGrant_Acct as 
discountgrant
-  FROM M_Product_Category pc, M_Product_Category_Acct pca 
-  WHERE pc.M_Product_Category_ID=pca.M_Product_Category_ID
-  AND pca.C_AcctSchema_ID=? 
-  ORDER BY pc.IsDefault DESC, pc.Created
+      SELECT coalesce(acctsdef.P_Revenue_Acct, pca.P_Revenue_Acct) as revenue, 
coalesce(acctsdef.P_Expense_Acct, pca.P_Expense_Acct) as expense,
+             coalesce(acctsdef.P_Asset_Acct, pca.P_Asset_Acct) as asset, 
coalesce(acctsdef.P_Cogs_Acct, pca.P_Cogs_Acct) as cogs,
+             coalesce(acctsdef.P_PurchasePriceVariance_Acct, 
pca.P_PurchasePriceVariance_Acct) as purchasepricevariance,
+             coalesce(acctsdef.P_InvoicePriceVariance_Acct, 
pca.P_InvoicePriceVariance_Acct) as invoicepricevariance,
+             coalesce(acctsdef.P_TradeDiscountRec_Acct, 
pca.P_TradeDiscountRec_Acct) as discountrec,
+             coalesce(acctsdef.P_TradeDiscountGrant_Acct, 
pca.P_TradeDiscountGrant_Acct) as discountgrant
+      FROM M_Product_Category pc, M_Product_Category_Acct pca, 
c_acctschema_default acctsdef
+      WHERE pc.M_Product_Category_ID = pca.M_Product_Category_ID 
+            AND pca.c_acctschema_id = acctsdef.c_acctschema_id
+            AND pca.C_AcctSchema_ID= ?
+      ORDER BY pc.isdefault desc, pc.created
      ]]>
      </Sql>
      <Parameter name="AcctSchema"/>

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to