You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2009/11/18 12:23:14 UTC

svn commit: r881725 - /ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/test/AutoAcctgTransTests.xml

Author: lektran
Date: Wed Nov 18 11:23:13 2009
New Revision: 881725

URL: http://svn.apache.org/viewvc?rev=881725&view=rev
Log:
Change status of production run before issuing inventory to it's task
Removed log statement I left behind in a previous commit
Fixed testAcctgTransForActualManufacturingCost to properly lookup the production run and task to be completed
Start the task before attempting to complete it and added missing status from changeProductionRunTaskStatus call
Fixed wrong component productIds, they must have changed in the demo data at some point
Note the test still fails but it is now failing for the right reasons

Modified:
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/test/AutoAcctgTransTests.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=881725&r1=881724&r2=881725&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 Nov 18 11:23:13 2009
@@ -407,7 +407,7 @@
                  * Debit; in account 142000 - "WORK IN PROGRESS INVENTORY"; amount: 42$ -->
 
         <!-- Create a production run, TODO: move this to test data so we only have to do the issuance -->
-        <entity-one entity-name="UserLogin" value-field="serviceCtx.userLogin">
+        <entity-one entity-name="UserLogin" value-field="userLogin">
             <field-map field-name="userLoginId" value="system"/>
         </entity-one>
         <set field="serviceCtx.userLogin" from-field="userLogin"/>
@@ -415,9 +415,16 @@
         <set field="serviceCtx.pRQuantity" value="2" type="BigDecimal"/>
         <set field="serviceCtx.productId" value="PROD_MANUF"/>
         <set field="serviceCtx.startDate" value="${date:nowTimestamp()}" type="Timestamp"/>
+        <set field="serviceCtx.workEffortName" value="ACCTG_TEST_PROD_RUN"/>
         <call-service service-name="createProductionRun" in-map-name="serviceCtx">
             <result-to-field result-name="productionRunId"/>
         </call-service>
+    
+        <clear-field field="serviceCtx"/>
+        <set field="serviceCtx.userLogin" from-field="userLogin"/>
+        <set field="serviceCtx.productionRunId" from-field="productionRunId"/>
+        <set field="serviceCtx.statusId" value="PRUN_DOC_PRINTED"/>
+        <call-service service-name="changeProductionRunStatus" in-map-name="serviceCtx"/>
 
         <entity-and list="prodTasks" entity-name="WorkEffort">
             <field-map field-name="workEffortParentId" from-field="productionRunId"/>
@@ -431,7 +438,6 @@
         </entity-one>
         <call-service service-name="issueProductionRunTask" in-map-name="serviceCtx"/>
         <entity-condition entity-name="WorkEffortAndInventoryAssign" list="workEffortAndInventoryAssigns"/>
-        <iterate entry="workEffortAndInventoryAssign" list="workEffortAndInventoryAssigns"><log level="always" message="${workEffortAndInventoryAssign}"></log></iterate>
 
         <entity-condition entity-name="WorkEffortAndInventoryAssign" list="workEffortAndInventoryAssigns">
             <condition-list combine="and">
@@ -508,19 +514,35 @@
                 (1) productId = MAT_A_COST, quantity = 4, facilityId = Web Store Warehouse
                 (2) productId = MAT_B_COST, quantity = 6, facilityId = Web Store Warehouse
              then new production run is created, issued components for following product
-                (1) productId = PROD_COST,  quantity = 2, facilityId = Web Store Warehouse
+                (1) productId = PROD_MANUF,  quantity = 2, facilityId = Web Store Warehouse
              Post condition: In entity "AcctgTransEntry" two entries will be created:
                     * Credit: in account 600000 - "EXPENSE"; amount: 250$
                     * Debit: in account 142000 - "WORK IN PROGRESS INVENTORY", amount: 250$  -->
 
-        <set field="productionRunId" value="10000"/>
-        <set field="workEffortId" value="10001"/>
+        <!-- Find the production run created in the last test -->
+        <entity-and list="productionRuns" entity-name="WorkEffort">
+            <field-map field-name="workEffortName" value="ACCTG_TEST_PROD_RUN"/>
+            <field-map field-name="workEffortTypeId" value="PROD_ORDER_HEADER"/>
+            <field-map field-name="workEffortPurposeTypeId" value="WEPT_PRODUCTION_RUN"/>
+        </entity-and>
+        <first-from-list entry="productionRun" list="productionRuns"/>
+        <set field="productionRunId" from-field="productionRun.workEffortId"/>
+
+        <entity-and list="prodTasks" entity-name="WorkEffort">
+            <field-map field-name="workEffortParentId" from-field="productionRunId"/>
+        </entity-and>
+        <first-from-list entry="taskWorkEffort" list="prodTasks"/>
+        <set field="workEffortId" from-field="taskWorkEffort.workEffortId"/>
+
         <set field="serviceCtx.productionRunId" from-field="productionRunId"/>
         <set field="serviceCtx.workEffortId" from-field="workEffortId"/>
+        <set field="serviceCtx.statusId" value="PRUN_RUNNING"/>
         <entity-one entity-name="UserLogin" value-field="serviceCtx.userLogin">
             <field-map field-name="userLoginId" value="system"/>
         </entity-one>
         <call-service service-name="changeProductionRunTaskStatus" in-map-name="serviceCtx"/>
+        <set field="serviceCtx.statusId" value="PRUN_COMPLETED"/>
+        <call-service service-name="changeProductionRunTaskStatus" in-map-name="serviceCtx"/>
 
         <entity-one entity-name="WorkEffort" value-field="workEffort">
             <field-map field-name="workEffortId" from-field="workEffortId"/>
@@ -532,14 +554,14 @@
             <iterate list="acctgTransEntryList" entry="acctgTransEntry">
                 <if-compare field="acctgTransEntry.debitCreditFlag" operator="equals" value="C">
                     <assert>
-                        <if-compare field="acctgTransEntry.productId" operator="equals" value="PROD_COST"/>
+                        <if-compare field="acctgTransEntry.productId" operator="equals" value="PROD_MANUF"/>
                         <if-compare field="acctgTransEntry.glAccountTypeId" operator="equals" value="OPERATING_EXPENSE"/>
                         <if-compare field="acctgTransEntry.glAccountId" operator="equals" value="600000"/>
                     </assert>
                 <else>
                     <if-compare field="acctgTransEntry.debitCreditFlag" operator="equals" value="D">
                         <assert>
-                            <if-compare field="acctgTransEntry.productId" operator="equals" value="PROD_COST"/>
+                            <if-compare field="acctgTransEntry.productId" operator="equals" value="PROD_MANUF"/>
                             <if-compare field="acctgTransEntry.glAccountTypeId" operator="equals" value="WIP_INVENTORY"/>
                             <if-compare field="acctgTransEntry.glAccountId" operator="equals" value="142000"/>
                         </assert>