svn commit: r757749 - in /ofbiz/trunk/applications: order/servicedef/secas.xml order/servicedef/services.xml product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml

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

svn commit: r757749 - in /ofbiz/trunk/applications: order/servicedef/secas.xml order/servicedef/services.xml product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml

mor-2
Author: mor
Date: Tue Mar 24 12:02:34 2009
New Revision: 757749

URL: http://svn.apache.org/viewvc?rev=757749&view=rev
Log:
Adjust Purchase Order Items if received quantity is higher.
Applied slightly different patch from OFBIZ-2249 (https://issues.apache.org/jira/browse/OFBIZ-2249)

Thanks Pratik Khera and Pranay Pandey.

Pratik, I have done few changes in the service updatePoOnReceiveInventory.
1) Used service updateItemIssuance to update the records in ItemIssuance entity instead through <store-value>. If their is a service, then service should be used
   for such purpose.
2) Removed <clear-field> tag, it seems to me that they are not required.

Modified:
    ofbiz/trunk/applications/order/servicedef/secas.xml
    ofbiz/trunk/applications/order/servicedef/services.xml
    ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml

Modified: ofbiz/trunk/applications/order/servicedef/secas.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/secas.xml?rev=757749&r1=757748&r2=757749&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/secas.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/secas.xml Tue Mar 24 12:02:34 2009
@@ -47,6 +47,11 @@
         <condition field-name="facilityId" operator="is-not-empty"/>
         <action service="setUnitPriceAsLastPrice" mode="sync"/>
     </eca>
+    <eca service="receiveInventoryProduct" event="commit">
+        <condition field-name="facilityId" operator="is-not-empty"/>
+        <condition field-name="orderId" operator="is-not-empty"/>
+        <action service="updatePoOnReceiveInventory" mode="sync"/>
+    </eca>
     <eca service="changeOrderItemStatus" event="commit">
         <condition field-name="statusId" operator="equals" value="ITEM_CANCELLED"/>
         <action service="cancelOrderInventoryReservation" mode="sync"/>

Modified: ofbiz/trunk/applications/order/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services.xml?rev=757749&r1=757748&r2=757749&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/services.xml Tue Mar 24 12:02:34 2009
@@ -950,4 +950,11 @@
             location="component://order/script/org/ofbiz/order/order/OrderServices.xml" invoke="cancelAllBackOrders" auth="true">
         <description>Cancels those back orders from suppliers whose cancel back order date (cancelBackOrderDate) has passed the current date</description>
     </service>
+    <service name="updatePoOnReceiveInventory" engine="simple"
+            location="component://product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml" invoke="updatePoOnReceiveInventory">
+        <description>Update order items if quantity received is higher than quantity on purchase order</description>
+        <attribute name="orderId" type="String" mode="IN" optional="false"/>
+        <attribute name="orderItemSeqId" type="String" mode="IN" optional="false"/>
+        <attribute name="quantityAccepted"  type="BigDecimal" mode="IN" optional="false"/>
+    </service>
 </services>
\ No newline at end of file

Modified: ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml?rev=757749&r1=757748&r2=757749&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml Tue Mar 24 12:02:34 2009
@@ -313,5 +313,25 @@
             </if-compare>
         </if-compare>
     </simple-method>
+    
+    <simple-method method-name="updatePoOnReceiveInventory" short-description="Update order items if quantity received is higher than quantity on purchase order">
+        <set field="quantityAccepted" from-field="parameters.quantityAccepted" type="BigDecimal"/>
+        <entity-one entity-name="OrderItem" value-field="orderItem"/>
+        <if-compare-field field="orderItem.quantity" operator="less" to-field="quantityAccepted" type="BigDecimal">
+            <set field="orderItem.quantity" from-field="quantityAccepted"/>
+            <store-value  value-field="orderItem"/>
+        </if-compare-field>
+        <entity-and entity-name="ItemIssuance" list="itemIssuances">
+            <field-map field-name="orderId" from-field="parameters.orderId"/>
+            <field-map field-name="orderItemSeqId" from-field="parameters.orderItemSeqId"/>
+        </entity-and>
+        <first-from-list list="itemIssuances" entry="itemIssuance"/>
+        <if-not-empty field="itemIssuance">
+            <if-compare-field field="itemIssuance.quantity"  operator="less" to-field="quantityAccepted" type="BigDecimal">
+                <set field="itemIssuance.quantity" from-field="quantityAccepted"/>
+                <call-service service-name="updateItemIssuance" in-map-name="itemIssuance"/>
+            </if-compare-field>
+        </if-not-empty>
+    </simple-method>
 
-</simple-methods>
+</simple-methods>
\ No newline at end of file