You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2015/11/15 09:40:31 UTC

svn commit: r1714410 - in /ofbiz/trunk/applications/product: config/ProductEntityLabels.xml script/org/ofbiz/product/inventory/InventoryServices.xml

Author: jleroux
Date: Sun Nov 15 08:40:31 2015
New Revision: 1714410

URL: http://svn.apache.org/viewvc?rev=1714410&view=rev
Log:
A patch from Ankush Upadhyay attached by Ratnesh Upadhyay with analysis comments from Swapnil Shah for "Require Inventory of Marketing Package Product can't be shipped" https://issues.apache.org/jira/browse/OFBIZ-817 reported by Daniel Kunkel

Setting Require Inventory for a Marketing Product and (or ???) its Marketing Component causes the shiping system to fail. The shipping system reports nothing is ready to ship, ( [0 + 0 = 0] < 1 ).

---- exception report ----------------------------------------------------------
[TransactionUtil.setRollbackOnly] Calling transaction setRollbackOnly; this stack trace shows where this is happening:
Exception: java.lang.Exception

Message: Error in simple-method [Quick ships an entire order from multiple facilities [file:/wrk/ofbiz/ofbiz/applications/
product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml#quickShipEntireOrder]]: ; [Warning: no shipments created;
could not find anything ready and needing to be shipped.]

---- stack trace ---------------------------------------------------------------

java.lang.Exception: Error in simple-method [Quick ships an entire order from multiple facilities [file:/wrk/ofbiz/ofbiz/
applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml#quickShipEntireOrder]]: ; [Warning: no shipments
created; could not find anything ready and needing to be shipped.]

Swapnil Shah
As per further testing over trunk, it is found that setting requireInventory=Y over any marketing package type product means that for component products as well it would get honored even if its not set as Y for each or any of the components. 
In other words say,
* The flag is as set as Y for a marketing package type product A and it has ATP/QOH=15/15
* Product A has two component B & C as finished good and each having ATP/QOH = 8/8 and requireInventory is not set as Y for any of the components.
*  If sales order is attempted to be placed for A with ordered qty = 10 then system won't allow it to be placed because component B & C don't have sufficient ATP (irrespective of fact that none of them have requireInventory=Y)
Expected behavior in above case should be to allow user to place the order for Product A as it has sufficient ATP=15 to fulfill the ordered qty=10. If the ordered qty happens to exceed 15 then only it should prevent ordering based on requireInventory=Y

Ideally we shouldn't use the MARKETING_PKG product types as its a parent product type for product types MARKETING_PKG_AUTO, MARKETING_PKG_PICK. Thus we have changed the logic in "getMktgPackagesAvailable" service to handle product types MARKETING_PKG_AUTO, MARKETING_PKG_PICK to handle the reported issues more gracefully. Following are the changes we have done in the service vis-a-vis RequireInventory=Y setting for Package and/or its components. Now at the time of add to cart :
# if product type is MARKETING_PKG_AUTO then system will check it's own ATP instead of checking it's component ATP to allow or prevent placing order for package product..
# If product type is MARKETING_PKG_PICK then system will check it's component ATP to allow or prevent placing order for package product.

jleroux:
I agree with Swapnil,, since we can receive inventories of  MARKETING_PKG_AUTO, without regard to their components availability, I see no reasons why we could not ship them. 
BTW I tried the same with MARKETING_PKG_PICK and it works as expected: you need to have the components at hand to ship them even if you tried to receive an inventory before. Since they need to be picked this makes sense.

While at it I fixed a related French label, so it will be backported as well...

Modified:
    ofbiz/trunk/applications/product/config/ProductEntityLabels.xml
    ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml

Modified: ofbiz/trunk/applications/product/config/ProductEntityLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductEntityLabels.xml?rev=1714410&r1=1714409&r2=1714410&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/config/ProductEntityLabels.xml (original)
+++ ofbiz/trunk/applications/product/config/ProductEntityLabels.xml Sun Nov 15 08:40:31 2015
@@ -815,7 +815,7 @@
         <value xml:lang="de">Marketingpaket automatisch in Einzelpositionen aufteilen</value>
         <value xml:lang="en">Marketing Package Auto</value>
         <value xml:lang="es">Examinar automáticamente el componente del paquete de marketing</value>
-        <value xml:lang="fr">Marketing Package Auto Explode Component</value>
+        <value xml:lang="fr">Offre marketing construite automatiquement en fabrication</value>
         <value xml:lang="it">Pacco di vendita automatico</value>
         <value xml:lang="ja">販売パッケージ自動</value>
         <value xml:lang="nl">Marketing product - Autom.</value>

Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml?rev=1714410&r1=1714409&r2=1714410&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml Sun Nov 15 08:40:31 2015
@@ -755,14 +755,19 @@ under the License.
         <entity-one entity-name="Product" value-field="product"/>
         <set field="isMarketingPkgAuto" value="${groovy: org.ofbiz.entity.util.EntityTypeUtil.hasParentType(delegator, 'ProductType', 'productTypeId', product.productTypeId, 'parentTypeId', 'MARKETING_PKG_AUTO')}" type="Boolean"/>
         <if-compare field="isMarketingPkgAuto" operator="equals" value="true" type="Boolean">
-            <set value="MANUF_COMPONENT" field="lookupMktgPkgParams.type"/>
+            <set field="productIdMap.productId" from-field="product.productId"/>
+            <call-service service-name="getProductInventoryAvailable" in-map-name="productIdMap">
+                    <result-to-field result-name="availableToPromiseTotal"/>
+                    <result-to-field result-name="quantityOnHandTotal"/>
+            </call-service>
         <else>
             <set value="PRODUCT_COMPONENT" field="lookupMktgPkgParams.type"/>
+            <call-service service-name="getAssociatedProducts" in-map-name="lookupMktgPkgParams">
+                <result-to-field result-name="assocProducts"/>
+            </call-service>
         </else>
         </if-compare>
-        <call-service service-name="getAssociatedProducts" in-map-name="lookupMktgPkgParams">
-            <result-to-field result-name="assocProducts"/>
-        </call-service>
+
         <!-- if there are any components, then the ATP and QOH are based on the quantities of those component
             products and found with another service -->
         <if-not-empty field="assocProducts">
@@ -774,6 +779,7 @@ under the License.
                 <result-to-field result-name="availableToPromiseTotal"/>
             </call-service>
         </if-not-empty>
+
         <field-to-result field="availableToPromiseTotal"/>
         <field-to-result field="quantityOnHandTotal"/>
     </simple-method>