svn commit: r658688 - in /ofbiz/trunk/applications/accounting: script/org/ofbiz/accounting/test/AutoAcctgTransTests.xml testdef/accountingtests.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r658688 - in /ofbiz/trunk/applications/accounting: script/org/ofbiz/accounting/test/AutoAcctgTransTests.xml testdef/accountingtests.xml

mor-2
Author: mor
Date: Wed May 21 06:57:08 2008
New Revision: 658688

URL: http://svn.apache.org/viewvc?rev=658688&view=rev
Log:
Manually merged patch for testing accounting transaction process for edit invoice from Jira issue OFBIZ-1783 (https://issues.apache.org/jira/browse/OFBIZ-1783) with modifications / corrections (1) Added <assert> for checking acctg trans entry list (2) Used <if><else> pattern under <iterate> so that on iteration both condition (i.e Debit and Credit) are not checked every time (3) Grammatical mistake accouning -- > accounting in accountingtests.xml. Thanks Sumit Pandit for your patch.

Modified:
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/test/AutoAcctgTransTests.xml
    ofbiz/trunk/applications/accounting/testdef/accountingtests.xml

Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/test/AutoAcctgTransTests.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/test/AutoAcctgTransTests.xml?rev=658688&r1=658687&r2=658688&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/test/AutoAcctgTransTests.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/test/AutoAcctgTransTests.xml Wed May 21 06:57:08 2008
@@ -72,4 +72,59 @@
             </if-compare>
         </iterate>
     </simple-method>
+    
+    <simple-method method-name="testAcctgTransOnEditPoInvoice" short-description="Test case for Purchase Invoices: editing, adding taxes and shipping charges and posting to GL" login-required="false">
+        <!-- Precondition: To the Purchase Invoice created add taxes and two different shipping charges
+            1. for taxes: set "Invoice Item Type" = "Invoice Sales Tax" and "Unit Price" = 10$
+            2. for the first shipping charge: set "Invoice Item Type" = "Invoice Shipping And Handling" and "Unit Price" = 5$
+            3. for the second shipping charge: set "Invoice Item Type" = "Invoice Shipping And Handling", set "Override Gl Account Id" = "516100" and "Unit Price" = 5$
+        -->
+        <!-- Post condition: When status is set to ready, an accounting transaction is automatically posted to the GL:
+            * Credit; in account 210000 - "ACCOUNTS PAYABLE"; amount: 290$
+            * Debit; in account 214000 - "UNINVOICED ITEM RECEIPTS"; amount: 270$
+            * Debit; in account 516100 - "PURCHASE ORDER ADJUSTMENTS"; amount: 10$
+            * Debit; in account 510000 - "FREIGHT IN"; amount: 5$
+            * Debit; in account 516100 - "PURCHASE ORDER ADJUSTMENTS"; amount: 5$
+        -->
+
+        <set field="invoiceId" value="10000"/>
+        <entity-one entity-name="UserLogin" value-name="userLogin">
+            <field-map field-name="userLoginId" value="system"/>
+        </entity-one>
+        <set field="serviceCtx.userLogin" from-field="userLogin"/>
+        <set field="serviceCtx.statusId" value="INVOICE_READY"/>
+        <set field="serviceCtx.invoiceId" from-field="invoiceId"/>
+        <call-service service-name="setInvoiceStatus" in-map-name="serviceCtx"/>
+        <entity-one entity-name="Invoice" value-name="invoice">
+            <field-map field-name="invoiceId" env-name="invoiceId"/>
+        </entity-one>
+        <get-related value-name="invoice" relation-name="AcctgTrans" list-name="acctgTransList"/>
+        <first-from-list list-name="acctgTransList" entry-name="acctgTrans"/>
+        <get-related value-name="acctgTrans" relation-name="AcctgTransEntry" list-name="acctgTransEntries"/>
+        <set field="debitTotal" type="Double" value="0.0"/>
+        <set field="creditTotal" type="Double" value="0.0"/>
+        <assert><not><if-empty field-name="acctgTransEntries"/></not></assert>
+        <iterate entry-name="acctgTransEntry" list-name="acctgTransEntries">
+            <if-compare field-name="acctgTransEntry.debitCreditFlag" operator="equals" value="C">
+                <assert>
+                    <if-compare field-name="acctgTransEntry.glAccountTypeId" operator="equals" value="ACCOUNTS_PAYABLE"/>
+                    <if-compare field-name="acctgTransEntry.glAccountId" operator="equals" value="210000"/>
+                </assert>
+                <calculate field-name="creditTotal">
+                    <calcop operator="add" field-name="acctgTransEntry.origAmount"> </calcop>
+                </calculate>
+            <else>
+            <if-compare field-name="acctgTransEntry.debitCreditFlag" operator="equals" value="D">
+                <calculate field-name="debitTotal">
+                    <calcop operator="add" field-name="acctgTransEntry.origAmount"> </calcop>
+                </calculate>
+            </if-compare>
+            </else>    
+            </if-compare>
+        </iterate>
+        <assert>
+            <if-compare field-name="debitTotal" operator="equals" value="creditTotal"/>
+        </assert>            
+    </simple-method>
+    
 </simple-methods>
\ No newline at end of file

Modified: ofbiz/trunk/applications/accounting/testdef/accountingtests.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/testdef/accountingtests.xml?rev=658688&r1=658687&r2=658688&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/testdef/accountingtests.xml (original)
+++ ofbiz/trunk/applications/accounting/testdef/accountingtests.xml Wed May 21 06:57:08 2008
@@ -21,7 +21,10 @@
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">
     <test-case case-name="accounting-tests"><junit-test-suite class-name="org.ofbiz.accounting.test.FinAccountTests"/></test-case>
-    <test-case case-name="auto-accouning-transaction-tests-ReceiptPO">
+    <test-case case-name="auto-accounting-transaction-tests-PoReceipt">
         <simple-method-test location="component://accounting/script/org/ofbiz/accounting/test/AutoAcctgTransTests.xml" name="testAcctgTransOnPoReceipts"/>
     </test-case>
+    <test-case case-name="auto-accounting-transaction-tests-EditPoInvoice">
+        <simple-method-test location="component://accounting/script/org/ofbiz/accounting/test/AutoAcctgTransTests.xml" name="testAcctgTransOnEditPoInvoice"/>
+    </test-case>    
 </test-suite>