svn commit: r1758089 - /ofbiz/trunk/applications/product/minilang/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: r1758089 - /ofbiz/trunk/applications/product/minilang/shipment/receipt/ShipmentReceiptServices.xml

jleroux@apache.org
Author: jleroux
Date: Sun Aug 28 05:00:28 2016
New Revision: 1758089

URL: http://svn.apache.org/viewvc?rev=1758089&view=rev
Log:
A patch from Oleg Andreyev for "Cancelling shipment receipt doubles the inventory" https://issues.apache.org/jira/browse/OFBIZ-7943

When user cancel shipment receipt on PO it calls the service cancelReceivedItems that should revert inventory received. It doubles it instead because expression ${-1 * inventoryItem.quantityOnHandTotal} does not work really and does not return negative value.


Modified:
    ofbiz/trunk/applications/product/minilang/shipment/receipt/ShipmentReceiptServices.xml

Modified: ofbiz/trunk/applications/product/minilang/shipment/receipt/ShipmentReceiptServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/minilang/shipment/receipt/ShipmentReceiptServices.xml?rev=1758089&r1=1758088&r2=1758089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/minilang/shipment/receipt/ShipmentReceiptServices.xml (original)
+++ ofbiz/trunk/applications/product/minilang/shipment/receipt/ShipmentReceiptServices.xml Sun Aug 28 05:00:28 2016
@@ -544,8 +544,16 @@ under the License.
         <!-- create record for InventoryItemDetail entity -->
         <get-related-one value-field="shipmentReceipt" relation-name="InventoryItem" to-value-field="inventoryItem"/>
         <set field="inventoryItemDetailMap.inventoryItemId" from-field="inventoryItem.inventoryItemId"/>
-        <set field="inventoryItemDetailMap.quantityOnHandDiff" value="${-1 * inventoryItem.quantityOnHandTotal}" type="BigDecimal"/>
-        <set field="inventoryItemDetailMap.availableToPromiseDiff" value="${-1 * inventoryItem.availableToPromiseTotal}" type="BigDecimal"/>
+        <calculate field="inventoryItemDetailMap.quantityOnHandDiff">
+            <calcop operator="multiply" field="inventoryItem.quantityOnHandTotal">
+                <number value="-1"/>
+            </calcop>
+        </calculate>
+        <calculate field="inventoryItemDetailMap.availableToPromiseDiff">
+            <calcop operator="multiply" field="inventoryItem.availableToPromiseTotal">
+                <number value="-1"/>
+            </calcop>
+        </calculate>
         <call-service service-name="createInventoryItemDetail" in-map-name="inventoryItemDetailMap"/>
         
         <!-- Balance the inventory item -->