[OFBiz] SVN: r7036 - in trunk/applications/product: script/org/ofbiz/product/inventory script/org/ofbiz/product/product src/org/ofbiz/product/inventory
jacopo@svn.ofbiz.org
jacopo at svn.ofbiz.org
Tue Mar 21 04:30:44 CST 2006
Author: jacopo
Date: 2006-03-21 04:30:28 -0600 (Tue, 21 Mar 2006)
New Revision: 7036
Modified:
trunk/applications/product/script/org/ofbiz/product/inventory/InventoryReserveServices.xml
trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml
trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
Log:
We should always create new InventoryItems using the createInventoryItem service (instead of the delegator).
Modified: trunk/applications/product/script/org/ofbiz/product/inventory/InventoryReserveServices.xml
===================================================================
--- trunk/applications/product/script/org/ofbiz/product/inventory/InventoryReserveServices.xml 2006-03-21 05:48:18 UTC (rev 7035)
+++ trunk/applications/product/script/org/ofbiz/product/inventory/InventoryReserveServices.xml 2006-03-21 10:30:28 UTC (rev 7036)
@@ -161,13 +161,18 @@
<clear-field field-name="reserveOisgirMap"/>
<else>
<!-- no non-ser inv item, create a non-ser InventoryItem with availableToPromise = -quantityNotReserved -->
- <make-value entity-name="InventoryItem" value-name="newNonSerInventoryItem"/>
- <sequenced-id-to-env sequence-name="InventoryItem" env-name="newNonSerInventoryItem.inventoryItemId"/>
- <set from-field="parameters.productId" field="newNonSerInventoryItem.productId"/>
- <set from-field="parameters.facilityId" field="newNonSerInventoryItem.facilityId"/>
- <set from-field="parameters.containerId" field="newNonSerInventoryItem.containerId"/>
- <set value="NON_SERIAL_INV_ITEM" field="newNonSerInventoryItem.inventoryItemTypeId"/>
- <create-value value-name="newNonSerInventoryItem"/>
+ <clear-field field-name="createInventoryItemInMap"/>
+ <clear-field field-name="createInventoryItemOutMap"/>
+ <set from-field="parameters.productId" field="createInventoryItemInMap.productId"/>
+ <set from-field="parameters.facilityId" field="createInventoryItemInMap.facilityId"/>
+ <set from-field="parameters.containerId" field="createInventoryItemInMap.containerId"/>
+ <set value="NON_SERIAL_INV_ITEM" field="createInventoryItemInMap.inventoryItemTypeId"/>
+ <call-service service-name="createInventoryItem" in-map-name="createInventoryItemInMap">
+ <result-to-field result-name="inventoryItemId" field-name="createInventoryItemOutMap.inventoryItemId"/>
+ </call-service>
+ <entity-one entity-name="InventoryItem" value-name="newNonSerInventoryItem">
+ <field-map field-name="inventoryItemId" env-name="createInventoryItemOutMap.inventoryItemId"/>
+ </entity-one>
<!-- also create a detail record with the quantities -->
<set from-field="newNonSerInventoryItem.inventoryItemId" field="createDetailMap.inventoryItemId"/>
Modified: trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml
===================================================================
--- trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml 2006-03-21 05:48:18 UTC (rev 7035)
+++ trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml 2006-03-21 10:30:28 UTC (rev 7036)
@@ -247,6 +247,15 @@
<if-not-empty field-name="duplicateInventoryItems" map-name="parameters">
<find-by-and entity-name="InventoryItem" map-name="productFindContext" list-name="foundValues"/>
<iterate entry-name="foundValue" list-name="foundValues">
+ <!--
+ NOTE: new inventory items should always be created calling the
+ createInventoryItem service because in this way we are sure
+ that all the relevant fields are filled with default values.
+ However, the code here should work fine because all the values
+ for the new inventory item are inerited from the existing item.
+ TODO: is this code correct? What is the meaning of duplicating inventory items?
+ What about the InventoryItemDetail entries?
+ -->
<clone-value value-name="foundValue" new-value-name="newTempValue"/>
<set from-field="parameters.productId" field="newTempValue.productId"/>
<!-- this one is slightly different because it needs a new sequenced inventoryItemId -->
Modified: trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
===================================================================
--- trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java 2006-03-21 05:48:18 UTC (rev 7035)
+++ trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java 2006-03-21 10:30:28 UTC (rev 7036)
@@ -109,6 +109,11 @@
// however, if atp < qoh && atp == xferQty, then we still need to split; oh, but no need to check atp == xferQty in the second part because if it isn't greater and isn't less, then it is equal
if (xferQty.doubleValue() < atp.doubleValue() || atp.doubleValue() < qoh.doubleValue()) {
Double negXferQty = new Double(-xferQty.doubleValue());
+ // NOTE: new inventory items should always be created calling the
+ // createInventoryItem service because in this way we are sure
+ // that all the relevant fields are filled with default values.
+ // However, the code here should work fine because all the values
+ // for the new inventory item are inerited from the existing item.
newItem = GenericValue.create(inventoryItem);
String newSeqId = null;
More information about the Svn
mailing list