Skip to content

Commit

Permalink
[OFBIZ-4559] Fixed issue: InventoryWorker.getOutstandingProductQuanti…
Browse files Browse the repository at this point in the history
…ties returns inaccurate results when there are multiple ItemIssuances for an order, created new view entity called ItemIssuanceQuantitySum. This view entity will have sum of issued item grouped by orderItem of Order. Then this view entity is used in OrderItemQuantityReportGroupByProduct view entity instead of ItemIssuance entity. By doing this, we get accurate results.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1686651 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Divesh Dutta committed Jun 20, 2015
1 parent 7288cf2 commit 2980931
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions applications/order/entitydef/entitymodel_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -836,13 +836,22 @@ under the License.
<key-map field-name="inventoryItemId"/>
</relation>
</view-entity>
<view-entity entity-name="ItemIssuanceQuantitySum"
package-name="org.ofbiz.order.order"
never-cache="true"
title="Sum item issuance quantity to use directly in OrderItemQuantityReportGroupByItem and OrderItemQuantityReportGroupByProduct entities">
<member-entity entity-alias="II" entity-name="ItemIssuance"/>
<alias entity-alias="II" name="issuedQuantitySum" field="quantity" function="sum"/>
<alias entity-alias="II" name="orderId" field="orderId" group-by="true"/>
<alias entity-alias="II" name="orderItemSeqId" field="orderItemSeqId" group-by="true"/>
</view-entity>
<view-entity entity-name="OrderItemQuantityReportGroupByItem"
package-name="org.ofbiz.order.order"
never-cache="true"
title="Reports quantity ordered, issued and open by item for OrderItems.">
<member-entity entity-alias="OH" entity-name="OrderHeader"/>
<member-entity entity-alias="OI" entity-name="OrderItem"/>
<member-entity entity-alias="II" entity-name="ItemIssuance"/>
<member-entity entity-alias="II" entity-name="ItemIssuanceQuantitySum"/>
<alias entity-alias="OH" name="productStoreId" group-by="false"/>
<alias entity-alias="OH" name="orderId" group-by="true"/>
<alias entity-alias="OH" name="orderTypeId" group-by="false"/>
Expand All @@ -860,12 +869,12 @@ under the License.
<complex-alias-field entity-alias="OI" field="cancelQuantity" default-value="0"/>
</complex-alias>
</alias>
<alias entity-alias="II" name="quantityIssued" field="quantity" function="sum"/>
<alias entity-alias="OI" name="quantityOpen" function="sum">
<alias entity-alias="II" name="quantityIssued" field="issuedQuantitySum" function="min" />
<alias entity-alias="OI" name="quantityOpen" function="sum" >
<complex-alias operator="-">
<complex-alias-field entity-alias="OI" field="quantity" default-value="0"/>
<complex-alias-field entity-alias="OI" field="cancelQuantity" default-value="0"/>
<complex-alias-field entity-alias="II" field="quantity" default-value="0"/>
<complex-alias-field entity-alias="II" field="issuedQuantitySum" default-value="0"/>
</complex-alias>
</alias>
<view-link entity-alias="OI" rel-entity-alias="OH">
Expand All @@ -886,7 +895,7 @@ under the License.
title="Reports quantity ordered, issued and open by product for OrderItems.">
<member-entity entity-alias="OH" entity-name="OrderHeader"/>
<member-entity entity-alias="OI" entity-name="OrderItem"/>
<member-entity entity-alias="II" entity-name="ItemIssuance"/>
<member-entity entity-alias="II" entity-name="ItemIssuanceQuantitySum"/>
<alias entity-alias="OH" name="orderTypeId" group-by="true"/>
<alias entity-alias="OH" name="orderStatusId" field="statusId" group-by="false"/>
<alias entity-alias="OH" name="orderDate" group-by="false"/>
Expand All @@ -899,12 +908,12 @@ under the License.
<complex-alias-field entity-alias="OI" field="cancelQuantity" default-value="0"/>
</complex-alias>
</alias>
<alias entity-alias="II" name="quantityIssued" field="quantity" function="sum"/>
<alias entity-alias="II" name="quantityIssued" field="issuedQuantitySum" function="min"/>
<alias entity-alias="OI" name="quantityOpen" function="sum">
<complex-alias operator="-">
<complex-alias-field entity-alias="OI" field="quantity" default-value="0"/>
<complex-alias-field entity-alias="OI" field="cancelQuantity" default-value="0"/>
<complex-alias-field entity-alias="II" field="quantity" default-value="0"/>
<complex-alias-field entity-alias="II" field="issuedQuantitySum" default-value="0"/>
</complex-alias>
</alias>
<view-link entity-alias="OI" rel-entity-alias="OH">
Expand Down

0 comments on commit 2980931

Please sign in to comment.