<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->

<entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/entitymodel.xsd">
  <!-- ========================================================= -->
  <!-- ======================== Defaults ======================= -->
  <!-- ========================================================= -->
    <title>Entity of an Apache OFBiz Component</title>
    <description>None</description>
    <version>1.0</version>

  <!-- ========================================================= -->
  <!-- ======================== Data Model ===================== -->
  <!-- The modules in this file are as follows:                  -->
  <!--  - org.apache.ofbiz.order.order -->
  <!--  - org.apache.ofbiz.order.picklist -->
  <!--  - org.apache.ofbiz.order.quote -->
  <!--  - org.apache.ofbiz.order.request -->
  <!--  - org.apache.ofbiz.order.shoppingcart -->
  <!--  - org.apache.ofbiz.order.shoppinglist -->
  <!--  - org.apache.ofbiz.order.communication -->
  <!-- ========================================================= -->


  <!-- ========================================================= -->
  <!-- org.apache.ofbiz.order.order -->
  <!-- ========================================================= -->

    <view-entity entity-name="OrderHeaderAndItems"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Header And Order Items View Entity">
      <member-entity entity-alias="OH" entity-name="OrderHeader"/>
      <member-entity entity-alias="OI" entity-name="OrderItem"/>
      <alias entity-alias="OH" name="orderId"/>
      <alias entity-alias="OH" name="salesChannelEnumId"/>
      <alias entity-alias="OH" name="orderDate"/>
      <alias entity-alias="OH" name="orderStatusId" field="statusId"/>
      <alias entity-alias="OH" name="grandTotal"/>
      <alias entity-alias="OH" name="productStoreId"/>
      <alias entity-alias="OH" name="orderTypeId"/>
      <alias entity-alias="OI" name="orderItemSeqId"/>
      <alias entity-alias="OI" name="productId"/>
      <alias entity-alias="OI" name="quantity"/>
      <alias entity-alias="OI" name="cancelQuantity"/>
      <alias entity-alias="OI" name="unitPrice"/>
      <alias entity-alias="OI" name="unitListPrice"/>
      <alias entity-alias="OI" name="itemDescription"/>
      <alias entity-alias="OI" name="itemStatusId" field="statusId"/>
      <alias entity-alias="OI" name="estimatedShipDate"/>
      <alias entity-alias="OI" name="estimatedDeliveryDate"/>
      <alias entity-alias="OI" name="shipBeforeDate"/>
      <alias entity-alias="OI" name="shipAfterDate"/>
      <alias entity-alias="OI" name="orderItemTypeId"/>
      <view-link entity-alias="OH" rel-entity-alias="OI">
        <key-map field-name="orderId"/>
      </view-link>
    </view-entity>

    <view-entity entity-name="OrderHeaderAndItemFacilityLocation"
            package-name="org.apache.ofbiz.order.order"
           title="OrderHeader, OrderItemShipGrpInvRes, OrderItemShipGroup, InventoryItem and FacilityLocation View Entity">
      <member-entity entity-alias="OH" entity-name="OrderHeader"/>
      <member-entity entity-alias="OISGIR" entity-name="OrderItemShipGrpInvRes"/>
      <member-entity entity-alias="OISG" entity-name="OrderItemShipGroup"/>
      <member-entity entity-alias="II" entity-name="InventoryItem"/>
      <member-entity entity-alias="FL" entity-name="FacilityLocation"/>

      <alias entity-alias="OH" name="orderId"/>
      <alias entity-alias="OISGIR" name="orderItemSeqId"/>
      <alias entity-alias="OISGIR" name="inventoryItemId"/>
      <alias entity-alias="OISG" name="shipGroupSeqId"/>
      <alias entity-alias="OISG" name="shipmentMethodTypeId"/>
      <alias entity-alias="OISG" name="carrierPartyId"/>
      <alias entity-alias="II" name="productId"/>
      <alias entity-alias="II" name="facilityId"/>
      <alias entity-alias="II" name="locationSeqId"/>
      <alias entity-alias="FL" name="locationTypeEnumId"/>
      <alias entity-alias="FL" name="areaId"/>
      <view-link entity-alias="OH" rel-entity-alias="OISGIR">
        <key-map field-name="orderId"/>
      </view-link>
      <view-link entity-alias="OISGIR" rel-entity-alias="OISG">
        <key-map field-name="orderId"/>
        <key-map field-name="shipGroupSeqId"/>
      </view-link>
      <view-link entity-alias="OISGIR" rel-entity-alias="II">
        <key-map field-name="inventoryItemId"/>
      </view-link>
      <view-link entity-alias="II" rel-entity-alias="FL" rel-optional="true">
        <key-map field-name="facilityId"/>
        <key-map field-name="locationSeqId"/>
      </view-link>
    </view-entity>

    <view-entity entity-name="OrderHeaderAndPaymentPref"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Header And Payment Preference View Entity">
      <member-entity entity-alias="PF" entity-name="OrderPaymentPreference"/>
      <member-entity entity-alias="OH" entity-name="OrderHeader"/>
      <alias entity-alias="OH" name="orderId"/>
      <alias entity-alias="OH" name="orderDate"/>
      <alias entity-alias="OH" name="originFacilityId"/>
      <alias entity-alias="OH" name="productStoreId"/>
      <alias entity-alias="OH" name="terminalId"/>
      <alias entity-alias="OH" name="webSiteId"/>
      <alias entity-alias="OH" name="currencyUom"/>
      <alias entity-alias="PF" name="orderPaymentPreferenceId"/>
      <alias entity-alias="PF" name="paymentMethodTypeId"/>
      <alias entity-alias="OH" name="orderStatusId" field="statusId"/>
      <alias entity-alias="PF" name="paymentStatusId" field="statusId"/>
      <alias entity-alias="PF" name="maxAmount"/>
      <view-link entity-alias="OH" rel-entity-alias="PF">
        <key-map field-name="orderId"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="OrderPaymentPreference">
        <key-map field-name="orderPaymentPreferenceId"/>
      </relation>
    </view-entity>
    <view-entity entity-name="OrderPaymentPrefAndPayment"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Payment Preference and Payment View Entity">
      <member-entity entity-alias="PF" entity-name="OrderPaymentPreference"/>
      <member-entity entity-alias="PMT" entity-name="Payment"/>
      <alias entity-alias="PF" name="orderPaymentPreferenceId"/>
      <alias entity-alias="PF" name="orderId"/>
      <alias entity-alias="PF" name="statusId"/>
      <alias entity-alias="PMT" name="paymentId"/>
      <alias entity-alias="PMT" name="paymentTypeId"/>
      <alias entity-alias="PMT" name="amount"/>
      <view-link entity-alias="PF" rel-entity-alias="PMT">
        <key-map field-name="orderPaymentPreferenceId" rel-field-name="paymentPreferenceId"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
    </view-entity>
    <view-entity entity-name="OrderHeaderAndRoleSummary"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Header And Roles View Entity">
      <member-entity entity-alias="ORLE" entity-name="OrderRole"/>
      <member-entity entity-alias="OH" entity-name="OrderHeader"/>
      <alias entity-alias="ORLE" name="partyId" group-by="true"/>
      <alias entity-alias="ORLE" name="roleTypeId" group-by="true"/>
      <alias entity-alias="OH" name="orderId"/>
      <alias entity-alias="OH" name="orderTypeId" group-by="true"/>
      <alias entity-alias="OH" name="orderDate"/>
      <alias entity-alias="OH" name="statusId" group-by="true"/>
      <alias entity-alias="OH" name="totalGrandAmount" field="grandTotal" function="sum"/>
      <alias entity-alias="OH" name="totalSubRemainingAmount" field="remainingSubTotal" function="sum"/>
      <alias entity-alias="OH" name="totalOrders" field="orderId" function="count"/>
      <view-link entity-alias="ORLE" rel-entity-alias="OH">
        <key-map field-name="orderId"/>
      </view-link>
    </view-entity>
    <view-entity entity-name="OrderHeaderAndRoles"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Header And Roles View Entity">
      <member-entity entity-alias="ORLE" entity-name="OrderRole"/>
      <member-entity entity-alias="OH" entity-name="OrderHeader"/>
      <alias-all entity-alias="ORLE"/>
      <alias-all entity-alias="OH"/>
      <view-link entity-alias="ORLE" rel-entity-alias="OH">
        <key-map field-name="orderId"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="OrderType">
        <key-map field-name="orderTypeId"/>
      </relation>
      <relation type="one-nofk" title="Origin" rel-entity-name="Facility">
        <key-map field-name="originFacilityId" rel-field-name="facilityId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderTypeAttr">
        <key-map field-name="orderTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderAttribute">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderAdjustment">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderContactMech">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItemBilling">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItemContactMech">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItemRole">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderRole">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderShipment">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderStatus">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderTerm">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="WorkOrderItemFulfillment">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="ProductOrderItem">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="BillingAccount">
        <key-map field-name="billingAccountId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderPaymentPreference">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderHeaderNoteView">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="UserLogin">
        <key-map field-name="createdBy" rel-field-name="userLoginId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
      <relation type="one-nofk" title="Sync" rel-entity-name="StatusItem">
        <key-map field-name="syncStatusId" rel-field-name="statusId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderRequirementCommitment">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="ShipmentReceipt">
        <key-map field-name="orderId"/>
      </relation>
    </view-entity>
    <view-entity entity-name="OrderHeaderItemAndInv"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Header And Roles View Entity">
      <member-entity entity-alias="OH" entity-name="OrderHeader"/>
      <member-entity entity-alias="OI" entity-name="OrderItem"/>
      <member-entity entity-alias="IV" entity-name="OrderItemShipGrpInvRes"/>
      <alias entity-alias="OH" name="orderId"/>
      <alias entity-alias="OH" name="orderTypeId"/>
      <alias entity-alias="OH" name="orderDate"/>
      <alias entity-alias="OH" name="entryDate"/>
      <alias entity-alias="OH" name="visitId"/>
      <alias entity-alias="OH" name="statusId"/>
      <alias entity-alias="OH" name="createdBy"/>
      <alias entity-alias="OH" name="firstAttemptOrderId"/>
      <alias entity-alias="OH" name="currencyUom"/>
      <alias entity-alias="OH" name="syncStatusId"/>
      <alias entity-alias="OH" name="billingAccountId"/>
      <alias entity-alias="OH" name="originFacilityId"/>
      <alias entity-alias="OH" name="productStoreId"/>
      <alias entity-alias="OH" name="webSiteId"/>
      <alias entity-alias="OH" name="grandTotal"/>
      <alias entity-alias="OH" name="remainingSubTotal"/>
      <alias entity-alias="OI" name="productId"/>
      <alias entity-alias="OI" name="quantity"/>
      <alias entity-alias="OI" name="unitPrice"/>
      <alias entity-alias="OI" name="unitListPrice"/>
      <alias entity-alias="OI" name="estimatedShipDate"/>
      <alias entity-alias="OI" name="autoCancelDate"/>
      <alias entity-alias="OI" name="correspondingPoId"/>
      <alias entity-alias="IV" name="quantityNotAvailable"/>
      <view-link entity-alias="OH" rel-entity-alias="OI">
        <key-map field-name="orderId"/>
      </view-link>
      <view-link entity-alias="OI" rel-entity-alias="IV">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="OrderType">
        <key-map field-name="orderTypeId"/>
      </relation>
      <relation type="one-nofk" title="Origin" rel-entity-name="Facility">
        <key-map field-name="originFacilityId" rel-field-name="facilityId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderTypeAttr">
        <key-map field-name="orderTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderAttribute">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderAdjustment">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderContactMech">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItemBilling">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItemContactMech">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItemRole">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderRole">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderShipment">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderStatus">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderTerm">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="WorkOrderItemFulfillment">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="ProductOrderItem">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="BillingAccount">
        <key-map field-name="billingAccountId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderPaymentPreference">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderHeaderNoteView">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="UserLogin">
        <key-map field-name="createdBy" rel-field-name="userLoginId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
      <relation type="one-nofk" title="Sync" rel-entity-name="StatusItem">
        <key-map field-name="syncStatusId" rel-field-name="statusId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderRequirementCommitment">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="ShipmentReceipt">
        <key-map field-name="orderId"/>
      </relation>
    </view-entity>
    <view-entity entity-name="OrderHeaderItemAndInvRoles"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Header And Roles View Entity">
      <member-entity entity-alias="OT" entity-name="OrderRole"/>
      <member-entity entity-alias="OH" entity-name="OrderHeader"/>
      <member-entity entity-alias="OI" entity-name="OrderItem"/>
      <member-entity entity-alias="IV" entity-name="OrderItemShipGrpInvRes"/>
      <alias entity-alias="OH" name="orderId"/>
      <alias entity-alias="OT" name="partyId"/>
      <alias entity-alias="OT" name="roleTypeId"/>
      <alias entity-alias="OH" name="orderTypeId"/>
      <alias entity-alias="OH" name="orderDate"/>
      <alias entity-alias="OH" name="entryDate"/>
      <alias entity-alias="OH" name="visitId"/>
      <alias entity-alias="OH" name="statusId"/>
      <alias entity-alias="OH" name="createdBy"/>
      <alias entity-alias="OH" name="firstAttemptOrderId"/>
      <alias entity-alias="OH" name="currencyUom"/>
      <alias entity-alias="OH" name="syncStatusId"/>
      <alias entity-alias="OH" name="billingAccountId"/>
      <alias entity-alias="OH" name="originFacilityId"/>
      <alias entity-alias="OH" name="productStoreId"/>
      <alias entity-alias="OH" name="webSiteId"/>
      <alias entity-alias="OH" name="grandTotal"/>
      <alias entity-alias="OH" name="remainingSubTotal"/>
      <alias entity-alias="OI" name="productId"/>
      <alias entity-alias="OI" name="quantity"/>
      <alias entity-alias="OI" name="unitPrice"/>
      <alias entity-alias="OI" name="unitListPrice"/>
      <alias entity-alias="OI" name="estimatedShipDate"/>
      <alias entity-alias="OI" name="autoCancelDate"/>
      <alias entity-alias="OI" name="correspondingPoId"/>
      <alias entity-alias="IV" name="quantityNotAvailable"/>
      <view-link entity-alias="OT" rel-entity-alias="OH">
        <key-map field-name="orderId"/>
      </view-link>
      <view-link entity-alias="OH" rel-entity-alias="OI">
        <key-map field-name="orderId"/>
      </view-link>
      <view-link entity-alias="OI" rel-entity-alias="IV">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="OrderType">
        <key-map field-name="orderTypeId"/>
      </relation>
      <relation type="one-nofk" title="Origin" rel-entity-name="Facility">
        <key-map field-name="originFacilityId" rel-field-name="facilityId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderTypeAttr">
        <key-map field-name="orderTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderAttribute">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderAdjustment">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderContactMech">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItemBilling">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItemContactMech">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItemRole">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderRole">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderShipment">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderStatus">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderTerm">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="WorkOrderItemFulfillment">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="ProductOrderItem">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="BillingAccount">
        <key-map field-name="billingAccountId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderPaymentPreference">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderHeaderNoteView">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="UserLogin">
        <key-map field-name="createdBy" rel-field-name="userLoginId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
      <relation type="one-nofk" title="Sync" rel-entity-name="StatusItem">
        <key-map field-name="syncStatusId" rel-field-name="statusId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderRequirementCommitment">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="ShipmentReceipt">
        <key-map field-name="orderId"/>
      </relation>
    </view-entity>
    <view-entity entity-name="OrderHeaderItemAndRoles"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Header And Roles View Entity">
      <member-entity entity-alias="OT" entity-name="OrderRole"/>
      <member-entity entity-alias="OH" entity-name="OrderHeader"/>
      <member-entity entity-alias="OI" entity-name="OrderItem"/>
      <alias entity-alias="OH" name="orderName"/>
      <alias entity-alias="OH" name="orderId"/>
      <alias entity-alias="OT" name="partyId"/>
      <alias entity-alias="OT" name="roleTypeId"/>
      <alias entity-alias="OH" name="orderTypeId"/>
      <alias entity-alias="OH" name="orderDate"/>
      <alias entity-alias="OH" name="entryDate"/>
      <alias entity-alias="OH" name="visitId"/>
      <alias entity-alias="OH" name="statusId"/>
      <alias entity-alias="OH" name="createdBy"/>
      <alias entity-alias="OH" name="firstAttemptOrderId"/>
      <alias entity-alias="OH" name="currencyUom"/>
      <alias entity-alias="OH" name="syncStatusId"/>
      <alias entity-alias="OH" name="billingAccountId"/>
      <alias entity-alias="OH" name="originFacilityId"/>
      <alias entity-alias="OH" name="productStoreId"/>
      <alias entity-alias="OH" name="webSiteId"/>
      <alias entity-alias="OH" name="grandTotal"/>
      <alias entity-alias="OH" name="remainingSubTotal"/>
      <alias entity-alias="OI" name="productId"/>
      <alias entity-alias="OI" name="quantity"/>
      <alias entity-alias="OI" name="unitPrice"/>
      <alias entity-alias="OI" name="unitListPrice"/>
      <alias entity-alias="OI" name="estimatedShipDate"/>
      <alias entity-alias="OI" name="autoCancelDate"/>
      <alias entity-alias="OI" name="correspondingPoId"/>
      <alias entity-alias="OI" name="orderItemTypeId"/>
      <alias entity-alias="OI" name="itemDescription"/>
      <alias entity-alias="OI" name="orderItemSeqId"/>
      <alias entity-alias="OI" name="orderItemStatusId" field="statusId"/>
      <view-link entity-alias="OT" rel-entity-alias="OH">
        <key-map field-name="orderId"/>
      </view-link>
      <view-link entity-alias="OH" rel-entity-alias="OI">
        <key-map field-name="orderId"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="OrderType">
        <key-map field-name="orderTypeId"/>
      </relation>
      <relation type="one-nofk" title="Origin" rel-entity-name="Facility">
        <key-map field-name="originFacilityId" rel-field-name="facilityId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderTypeAttr">
        <key-map field-name="orderTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderAttribute">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderAdjustment">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderContactMech">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItemBilling">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItemContactMech">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItemRole">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderRole">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderShipment">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderStatus">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderTerm">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="WorkOrderItemFulfillment">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="ProductOrderItem">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="BillingAccount">
        <key-map field-name="billingAccountId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderPaymentPreference">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderHeaderNoteView">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="UserLogin">
        <key-map field-name="createdBy" rel-field-name="userLoginId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
      <relation type="one-nofk" title="Sync" rel-entity-name="StatusItem">
        <key-map field-name="syncStatusId" rel-field-name="statusId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderRequirementCommitment">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="ShipmentReceipt">
        <key-map field-name="orderId"/>
      </relation>
    </view-entity>
    <view-entity entity-name="OrderHeaderNoteView"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Header Note View Entity">
      <member-entity entity-alias="OD" entity-name="OrderHeaderNote"/>
      <member-entity entity-alias="ND" entity-name="NoteData"/>
      <alias entity-alias="OD" name="orderId"/>
      <alias entity-alias="OD" name="internalNote"/>
      <alias entity-alias="ND" name="noteId"/>
      <alias entity-alias="ND" name="noteName"/>
      <alias entity-alias="ND" name="noteInfo"/>
      <alias entity-alias="ND" name="noteDateTime"/>
      <alias entity-alias="ND" name="noteParty"/>
      <view-link entity-alias="OD" rel-entity-alias="ND">
        <key-map field-name="noteId"/>
      </view-link>
    </view-entity>
    <view-entity entity-name="OrderItemAndProductContentInfo"
        package-name="org.apache.ofbiz.order.order"
        title="OrderItem And ProductContent Info View Entity">
        <member-entity entity-alias="OI" entity-name="OrderItem"/>
        <member-entity entity-alias="PC" entity-name="ProductContent"/>
        <member-entity entity-alias="CNT" entity-name="Content"/>
        <member-entity entity-alias="PDCT" entity-name="Product"/>
        <alias-all entity-alias="OI">
            <exclude field="comments"/>
        </alias-all>
        <alias-all entity-alias="PC"/>
        <alias-all entity-alias="CNT">
            <exclude field="statusId"/>
        </alias-all>
        <alias-all entity-alias="PDCT">
            <exclude field="description"/>
            <exclude field="createdDate"/>
            <exclude field="createdByUserLogin"/>
            <exclude field="lastModifiedDate"/>
            <exclude field="lastModifiedByUserLogin"/>
        </alias-all>
        <alias entity-alias="CNT" name="contentStatusId" field="statusId"/>
        <view-link entity-alias="OI" rel-entity-alias="PC">
            <key-map field-name="productId"/>
        </view-link>
        <view-link entity-alias="PC" rel-entity-alias="CNT">
            <key-map field-name="contentId"/>
        </view-link>
        <view-link entity-alias="OI" rel-entity-alias="PDCT">
            <key-map field-name="productId"/>
        </view-link>
        <relation type="one-nofk" rel-entity-name="Product">
            <key-map field-name="productId"/>
        </relation>
    </view-entity>
    <view-entity entity-name="OrderHeaderItemAndShipGroup"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="OrderHeader, OrderItem And ShipGroups View Entity">
      <member-entity entity-alias="OH" entity-name="OrderHeader"/>
      <member-entity entity-alias="OI" entity-name="OrderItem"/>
      <member-entity entity-alias="OISGA" entity-name="OrderItemShipGroupAssoc"/>
      <member-entity entity-alias="OISG" entity-name="OrderItemShipGroup"/>
      <member-entity entity-alias="OISGIR" entity-name="OrderItemShipGrpInvRes"/>
      <member-entity entity-alias="II" entity-name="InventoryItem"/>
      <alias-all entity-alias="OH"/>
      <alias-all entity-alias="OISGA"/>
      <alias-all entity-alias="OISG">
        <exclude field="facilityId"/>
      </alias-all>
      <alias-all entity-alias="OI">
        <exclude field="quantity"/>
        <exclude field="cancelQuantity"/>
        <exclude field="shipAfterDate"/>
        <exclude field="shipBeforeDate"/>
        <exclude field="estimatedShipDate"/>
        <exclude field="estimatedDeliveryDate"/>
        <exclude field="statusId"/>
        <exclude field="externalId"/>
        <exclude field="syncStatusId"/>
      </alias-all>
      <alias entity-alias="OI" name="oiQuantity" field="quantity"/>
      <alias entity-alias="OI" name="oiCancelQuantity" field="cancelQuantity"/>
      <alias entity-alias="OI" name="oiShipAfterDate" field="shipAfterDate"/>
      <alias entity-alias="OI" name="oiShipBeforeDate" field="shipBeforeDate"/>
      <alias entity-alias="OI" name="oiEstimatedShipDate" field="estimatedShipDate"/>
      <alias entity-alias="OI" name="oiEstimatedDeliveryDate" field="estimatedDeliveryDate"/>
      <alias entity-alias="OI" name="oiStatusId" field="statusId"/>
      <alias entity-alias="OI" name="oiExternalId" field="externalId"/>
      <alias entity-alias="OI" name="oiSyncStatusId" field="syncStatusId"/>
      <alias entity-alias="OISGIR" name="reservedQuantity" field="quantity"/>
      <alias entity-alias="II" name="facilityId"/>
      <view-link entity-alias="OH" rel-entity-alias="OI">
        <key-map field-name="orderId"/>
      </view-link>
      <view-link entity-alias="OI" rel-entity-alias="OISGA">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </view-link>
      <view-link entity-alias="OISGA" rel-entity-alias="OISG">
        <key-map field-name="orderId"/>
        <key-map field-name="shipGroupSeqId"/>
      </view-link>
      <view-link entity-alias="OISGA" rel-entity-alias="OISGIR" rel-optional="true">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
        <key-map field-name="shipGroupSeqId"/>
      </view-link>
      <view-link entity-alias="OISGIR" rel-entity-alias="II" rel-optional="true">
        <key-map field-name="inventoryItemId"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
    </view-entity>
    <view-entity entity-name="OrderItemAndShipGroupAssoc"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="OrderItem And ShipGroupAssoc View Entity">
      <member-entity entity-alias="OI" entity-name="OrderItem"/>
      <member-entity entity-alias="OISGA" entity-name="OrderItemShipGroupAssoc"/>
      <alias-all entity-alias="OI">
        <exclude field="quantity"/>
        <exclude field="cancelQuantity"/>
      </alias-all>
      <alias-all entity-alias="OISGA"/>
      <alias entity-alias="OI" name="orderItemQuantity" field="quantity"/>
      <alias entity-alias="OI" name="orderItemCancelQuantity" field="cancelQuantity"/>
      <view-link entity-alias="OI" rel-entity-alias="OISGA">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="Product">
        <key-map field-name="productId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
      <relation type="many" rel-entity-name="ItemIssuance">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
        <key-map field-name="shipGroupSeqId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItemShipGrpInvRes">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
        <key-map field-name="shipGroupSeqId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItemShipGrpInvResAndItem">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
        <key-map field-name="shipGroupSeqId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItemBilling">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderAdjustment">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItemAttribute">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
    </view-entity>
    <view-entity entity-name="OrderItemAndShipGrpInvResAndItem"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Item and Inventory Reservation View Entity">
      <member-entity entity-alias="OI" entity-name="OrderItem"/>
      <member-entity entity-alias="OISGIR" entity-name="OrderItemShipGrpInvRes"/>
      <member-entity entity-alias="II" entity-name="InventoryItem"/>
      <alias-all entity-alias="OI"/>
      <alias-all entity-alias="OISGIR">
        <exclude field="quantity"/>
      </alias-all>
      <alias-all entity-alias="II">
        <exclude field="productId"/>
        <exclude field="statusId"/>
        <exclude field="comments"/>
      </alias-all>
      <view-link entity-alias="OI" rel-entity-alias="OISGIR">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </view-link>
      <view-link entity-alias="OISGIR" rel-entity-alias="II">
        <key-map field-name="inventoryItemId"/>
      </view-link>
    </view-entity>
    <view-entity entity-name="OrderItemShipGrpInvResAndItem"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Item Inventory Reservation and Inventory Item View Entity">
      <member-entity entity-alias="OISGIR" entity-name="OrderItemShipGrpInvRes"/>
      <member-entity entity-alias="II" entity-name="InventoryItem"/>
      <alias-all entity-alias="OISGIR"/>
      <alias-all entity-alias="II"/>
      <view-link entity-alias="OISGIR" rel-entity-alias="II">
        <key-map field-name="inventoryItemId"/>
      </view-link>
    </view-entity>
    <view-entity entity-name="OrderItemShipGrpInvResAndItemLocation"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Item Inventory Reservation and Inventory Item and FacilityLocation View Entity">
      <member-entity entity-alias="OISGIR" entity-name="OrderItemShipGrpInvRes"/>
      <member-entity entity-alias="OI" entity-name="OrderItem"/>
      <member-entity entity-alias="II" entity-name="InventoryItem"/>
      <member-entity entity-alias="FL" entity-name="FacilityLocation"/>
      <alias-all entity-alias="OISGIR"/>
      <alias-all entity-alias="II"/>
      <alias-all entity-alias="FL"/>
      <alias entity-alias="OI" name="orderItemStatusId" field="statusId"/>
      <view-link entity-alias="OISGIR" rel-entity-alias="II">
        <key-map field-name="inventoryItemId"/>
      </view-link>
      <view-link entity-alias="II" rel-entity-alias="FL">
        <key-map field-name="facilityId"/>
        <key-map field-name="locationSeqId"/>
      </view-link>
      <view-link entity-alias="OISGIR" rel-entity-alias="OI">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="Product">
        <key-map field-name="productId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="FacilityLocation">
        <key-map field-name="facilityId"/>
        <key-map field-name="locationSeqId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="OrderItemShipGrpInvRes">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
        <key-map field-name="shipGroupSeqId"/>
        <key-map field-name="inventoryItemId"/>
      </relation>
    </view-entity>
    <view-entity entity-name="ItemIssuanceQuantitySum"
            package-name="org.apache.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.apache.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="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"/>
      <alias entity-alias="OH" name="orderStatusId" field="statusId" group-by="false"/>
      <alias entity-alias="OH" name="orderDate" group-by="true"/>
      <alias entity-alias="OI" name="orderItemSeqId" group-by="true"/>
      <alias entity-alias="OI" name="orderItemStatusId" field="statusId" group-by="false"/>
      <alias entity-alias="OI" name="productId" group-by="true"/>
      <alias entity-alias="OI" name="itemDescription" group-by="true"/>
      <alias entity-alias="OI" name="shipBeforeDate" group-by="true"/>
      <alias entity-alias="OI" name="shipAfterDate" group-by="true"/>
      <alias entity-alias="OI" name="quantityOrdered" 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>
      </alias>
      <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="issuedQuantitySum" default-value="0"/>
          </complex-alias>
      </alias>
      <view-link entity-alias="OI" rel-entity-alias="OH">
        <key-map field-name="orderId"/>
      </view-link>
      <view-link entity-alias="OI" rel-entity-alias="II" rel-optional="true">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="OrderItem">
          <key-map field-name="orderId"/>
          <key-map field-name="orderItemSeqId"/>
      </relation>
    </view-entity>
    <view-entity entity-name="OrderItemQuantityReportGroupByProduct"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            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="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"/>
      <alias entity-alias="OI" name="orderItemStatusId" field="statusId" group-by="false"/>
      <alias entity-alias="OI" name="productId" group-by="true"/>
      <alias entity-alias="OI" name="quantityOrdered" 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>
      </alias>
      <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="issuedQuantitySum" default-value="0"/>
          </complex-alias>
      </alias>
      <view-link entity-alias="OI" rel-entity-alias="OH">
        <key-map field-name="orderId"/>
      </view-link>
      <view-link entity-alias="OI" rel-entity-alias="II" rel-optional="true">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </view-link>
    </view-entity>
    <view-entity entity-name="OrderPurchasePaymentSummary"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Purchase Payment Summary View Entity">
      <member-entity entity-alias="OH" entity-name="OrderHeader"/>
      <member-entity entity-alias="OPP" entity-name="OrderPaymentPreference"/>
      <member-entity entity-alias="PMT" entity-name="PaymentMethodType"/>
      <!-- only the fields desired should be included in fields-to-select, and can otherwise be used as select critera (or both too) -->
      <alias entity-alias="OH" name="webSiteId" group-by="true"/>
      <alias entity-alias="OH" name="productStoreId" group-by="true"/>
      <alias entity-alias="OH" name="originFacilityId" group-by="true"/>
      <alias entity-alias="OH" name="terminalId" group-by="true"/>
      <alias entity-alias="OH" name="statusId" group-by="true"/>
      <alias entity-alias="OPP" name="paymentMethodTypeId" group-by="true"/>
      <alias entity-alias="PMT" name="description" group-by="true"/>
      <alias entity-alias="OPP" name="maxAmount" function="sum"/>
      <alias entity-alias="OH" name="orderId" group-by="true"/>
      <alias entity-alias="OH" name="orderTypeId" group-by="true"/>
      <alias entity-alias="OH" name="orderDate" group-by="true"/>
      <alias entity-alias="OH" name="billingAccountId" group-by="true"/>
      <alias entity-alias="OPP" name="preferenceStatusId" field="statusId" group-by="true"/>
      <view-link entity-alias="OH" rel-entity-alias="OPP">
        <key-map field-name="orderId"/>
      </view-link>
      <view-link entity-alias="OPP" rel-entity-alias="PMT">
        <key-map field-name="paymentMethodTypeId"/>
      </view-link>
    </view-entity>
    <view-entity entity-name="OrderPurchaseProductSummary"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Purchase Product Summary View Entity">
      <member-entity entity-alias="OH" entity-name="OrderHeader"/>
      <member-entity entity-alias="OI" entity-name="OrderItem"/>
      <member-entity entity-alias="PR" entity-name="Product"/>
      <!-- only the fields desired should be included in fields-to-select, and can otherwise be used as select critera (or both too) -->
      <alias entity-alias="OH" name="webSiteId" group-by="true"/>
      <alias entity-alias="OH" name="productStoreId" group-by="true"/>
      <alias entity-alias="OH" name="originFacilityId" group-by="true"/>
      <alias entity-alias="OH" name="terminalId" group-by="true"/>
      <alias entity-alias="OH" name="statusId" group-by="true"/>
      <alias entity-alias="PR" name="productId" group-by="true"/>
      <alias entity-alias="PR" name="internalName" group-by="true"/>
      <alias entity-alias="OI" name="quantity" function="sum"/>
      <alias entity-alias="OI" name="cancelQuantity" function="sum"/>
      <!-- these are not simple to use, and as below are not quite accurate since they are not weighted by quantity -->
      <alias entity-alias="OI" name="unitPrice" function="avg"/>
      <alias entity-alias="OI" name="unitListPrice" function="avg"/>
      <!-- these can be used for query, but generally won't be included in the fields-to-select -->
      <alias entity-alias="OH" name="orderId"/>
      <alias entity-alias="OH" name="orderTypeId"/>
      <alias entity-alias="OH" name="orderDate"/>
      <alias entity-alias="OI" name="itemStatusId" field="statusId"/>
      <view-link entity-alias="OH" rel-entity-alias="OI">
        <key-map field-name="orderId"/>
      </view-link>
      <view-link entity-alias="OI" rel-entity-alias="PR">
        <key-map field-name="productId"/>
      </view-link>
    </view-entity>
    <view-entity entity-name="OrderReportView"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Report View Entity">
      <member-entity entity-alias="OH" entity-name="OrderHeader"/>
      <member-entity entity-alias="OPP" entity-name="OrderPaymentPreference"/>
      <member-entity entity-alias="PMT" entity-name="PaymentMethodType"/>
      <member-entity entity-alias="OS" entity-name="StatusItem"/>
      <member-entity entity-alias="OI" entity-name="OrderItem"/>
      <member-entity entity-alias="OIS" entity-name="StatusItem"/>
      <alias entity-alias="OS" name="groupName" field="description"/>
      <alias entity-alias="OH" name="orderId"/>
      <alias entity-alias="OH" name="orderTypeId"/>
      <alias entity-alias="OH" name="orderDate"/>
      <alias entity-alias="OS" name="orderStatus" field="description"/>
      <alias entity-alias="PMT" name="paymentMethod" field="description"/>
      <alias entity-alias="OH" name="visitId"/>
      <alias entity-alias="OH" name="currencyUom"/>
      <alias entity-alias="OH" name="originFacilityId"/>
      <alias entity-alias="OH" name="webSiteId"/>
      <alias entity-alias="OH" name="grandTotal"/>
      <alias entity-alias="OI" name="productId"/>
      <alias entity-alias="OI" name="itemDescription"/>
      <alias entity-alias="OIS" name="itemStatus" field="description"/>
      <alias entity-alias="OI" name="quantity"/>
      <alias entity-alias="OI" name="unitPrice"/>
      <view-link entity-alias="OH" rel-entity-alias="OI">
        <key-map field-name="orderId"/>
      </view-link>
      <view-link entity-alias="OH" rel-entity-alias="OPP" rel-optional="true">
        <key-map field-name="orderId"/>
      </view-link>
      <view-link entity-alias="OPP" rel-entity-alias="PMT" rel-optional="true">
        <key-map field-name="paymentMethodTypeId"/>
      </view-link>
      <view-link entity-alias="OH" rel-entity-alias="OS">
        <key-map field-name="statusId"/>
      </view-link>
      <view-link entity-alias="OI" rel-entity-alias="OIS">
        <key-map field-name="statusId"/>
      </view-link>
    </view-entity>
    <view-entity entity-name="OrderRoleAndProductContentInfo"
        package-name="org.apache.ofbiz.order.order"
        title="OrderRole And OrderItem And ProductContent Info View Entity">
        <member-entity entity-alias="ORLE" entity-name="OrderRole"/>
        <member-entity entity-alias="OI" entity-name="OrderItem"/>
        <member-entity entity-alias="PC" entity-name="ProductContent"/>
        <member-entity entity-alias="CNT" entity-name="Content"/>
        <member-entity entity-alias="PDCT" entity-name="Product"/>
        <alias-all entity-alias="ORLE"/>
        <alias-all entity-alias="OI"/>
        <alias-all entity-alias="PC"/>
        <alias-all entity-alias="CNT">
            <exclude field="statusId"/>
        </alias-all>
        <alias entity-alias="PDCT" name="productName"/>
        <alias entity-alias="CNT" name="contentStatusId" field="statusId"/>
        <view-link entity-alias="ORLE" rel-entity-alias="OI">
            <key-map field-name="orderId"/>
        </view-link>
        <view-link entity-alias="OI" rel-entity-alias="PC">
            <key-map field-name="productId"/>
        </view-link>
        <view-link entity-alias="PC" rel-entity-alias="CNT">
            <key-map field-name="contentId"/>
        </view-link>
        <view-link entity-alias="OI" rel-entity-alias="PDCT">
            <key-map field-name="productId"/>
        </view-link>
        <relation type="one-nofk" rel-entity-name="Product">
            <key-map field-name="productId"/>
        </relation>
    </view-entity>
    <view-entity entity-name="OrderTaskList"
            package-name="org.apache.ofbiz.order.order"
            title="Order WorkEffort Task List">
      <member-entity entity-alias="OH" entity-name="OrderHeader"/>
      <member-entity entity-alias="OHR" entity-name="OrderRole"/>
      <member-entity entity-alias="PS" entity-name="Person"/>
      <member-entity entity-alias="WE" entity-name="WorkEffort"/>
      <member-entity entity-alias="WEPA" entity-name="WorkEffortPartyAssignment"/>
      <alias entity-alias="OH" name="orderId"/>
      <alias entity-alias="OH" name="orderTypeId"/>
      <alias entity-alias="OH" name="orderDate"/>
      <alias entity-alias="OH" name="entryDate"/>
      <alias entity-alias="OH" name="grandTotal"/>
      <alias entity-alias="OHR" name="orderRoleTypeId" field="roleTypeId"/>
      <alias entity-alias="OHR" name="customerPartyId" field="partyId"/>
      <alias entity-alias="PS" name="customerFirstName" field="firstName"/>
      <alias entity-alias="PS" name="customerLastName" field="lastName"/>
      <alias entity-alias="WE" name="workEffortId"/>
      <alias entity-alias="WE" name="workEffortTypeId"/>
      <alias entity-alias="WE" name="currentStatusId"/>
      <alias entity-alias="WE" name="lastStatusUpdate"/>
      <alias entity-alias="WE" name="priority"/>
      <alias entity-alias="WE" name="workEffortName"/>
      <alias entity-alias="WE" name="description"/>
      <alias entity-alias="WE" name="createdDate"/>
      <alias entity-alias="WE" name="createdByUserLogin"/>
      <alias entity-alias="WE" name="lastModifiedDate"/>
      <alias entity-alias="WE" name="lastModifiedByUserLogin"/>
      <alias entity-alias="WE" name="estimatedStartDate"/>
      <alias entity-alias="WE" name="estimatedCompletionDate"/>
      <alias entity-alias="WE" name="actualStartDate"/>
      <alias entity-alias="WE" name="actualCompletionDate"/>
      <alias entity-alias="WE" name="infoUrl"/>
      <alias entity-alias="WEPA" name="wepaPartyId" field="partyId"/>
      <alias entity-alias="WEPA" name="roleTypeId"/>
      <alias entity-alias="WEPA" name="fromDate"/>
      <alias entity-alias="WEPA" name="thruDate"/>
      <alias entity-alias="WEPA" name="statusId"/>
      <alias entity-alias="WEPA" name="statusDateTime"/>
      <view-link entity-alias="OH" rel-entity-alias="OHR" rel-optional="true">
        <key-map field-name="orderId"/>
      </view-link>
      <view-link entity-alias="OHR" rel-entity-alias="PS" rel-optional="true">
        <key-map field-name="partyId"/>
      </view-link>
      <view-link entity-alias="OH" rel-entity-alias="WE">
        <key-map field-name="orderId" rel-field-name="sourceReferenceId"/>
      </view-link>
      <view-link entity-alias="WE" rel-entity-alias="WEPA">
        <key-map field-name="workEffortId"/>
      </view-link>
    </view-entity>


    <view-entity entity-name="OrderHeaderAndShipGroups"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Header And Ship Groups">
      <member-entity entity-alias="OISG" entity-name="OrderItemShipGroup"/>
      <member-entity entity-alias="PA" entity-name="PostalAddress"/>
      <member-entity entity-alias="OH" entity-name="OrderHeader"/>
      <member-entity entity-alias="ORR" entity-name="OrderRole"/>
      <alias-all entity-alias="OISG"/>
      <alias-all entity-alias="PA"/>
      <alias-all entity-alias="ORR"/>
      <alias-all entity-alias="OH"/>
      <view-link entity-alias="OH" rel-entity-alias="OISG">
        <key-map field-name="orderId"/>
      </view-link>
      <view-link entity-alias="OISG" rel-entity-alias="PA">
        <key-map field-name="contactMechId"/>
      </view-link>
      <view-link entity-alias="OH" rel-entity-alias="ORR">
        <key-map field-name="orderId"/>
      </view-link>
    </view-entity>
    
    <view-entity entity-name="OrderHeaderAndShipGroupsByProduct"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Header And Ship Groups By Product">
      <member-entity entity-alias="OISG" entity-name="OrderItemShipGroup"/>
      <member-entity entity-alias="PA" entity-name="PostalAddress"/>
      <member-entity entity-alias="OH" entity-name="OrderHeader"/>
      <member-entity entity-alias="ORR" entity-name="OrderRole"/>
      <member-entity entity-alias="OI" entity-name="OrderItem"/>
      <member-entity entity-alias="PR" entity-name="Product"/>
      <alias-all entity-alias="OISG"/>
      <alias-all entity-alias="PA"/>
      <alias-all entity-alias="ORR"/>
      <alias-all entity-alias="OH"/>
      <alias name="productId" field="productId" entity-alias="PR"/>
      <alias name="brandName" field="brandName" entity-alias="PR"/>
      <alias name="internalName" field="internalName" entity-alias="PR"/>
      <view-link entity-alias="OH" rel-entity-alias="OISG">
        <key-map field-name="orderId"/>
      </view-link>
      <view-link entity-alias="OISG" rel-entity-alias="PA">
        <key-map field-name="contactMechId"/>
      </view-link>
      <view-link entity-alias="OH" rel-entity-alias="ORR">
        <key-map field-name="orderId"/>
      </view-link>
      <view-link entity-alias="OH" rel-entity-alias="OI">
        <key-map field-name="orderId"/>
      </view-link>
      <view-link entity-alias="OI" rel-entity-alias="PR">
        <key-map field-name="productId"/>
      </view-link>
    </view-entity>

    <view-entity entity-name="OrderReportSalesGroupByProduct"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Report Group By Product View Entity with extra details for sales order reporting">
      <member-entity entity-alias="OH" entity-name="OrderHeader"/>
      <member-entity entity-alias="OI" entity-name="OrderItem"/>
      <member-entity entity-alias="RL" entity-name="OrderRole"/>
      <member-entity entity-alias="PR" entity-name="Product"/>
      <member-entity entity-alias="PS" entity-name="ProductStore"/>
      <alias entity-alias="OH" name="productStoreId" group-by="true"/>
      <alias entity-alias="PS" name="storeName" group-by="true"/>
      <alias entity-alias="OI" name="productId" group-by="true"/>
      <alias entity-alias="PR" name="internalName" group-by="true"/>
      <alias entity-alias="OH" name="orderDate" group-by="false"/>
      <alias entity-alias="OH" name="orderStatusId" field="statusId" group-by="false"/>
      <alias entity-alias="OI" name="orderItemStatusId" field="statusId" group-by="false"/>
      <alias entity-alias="OH" name="orderTypeId" group-by="false"/>
      <alias entity-alias="RL" name="partyId" group-by="false"/>
      <alias entity-alias="RL" name="roleTypeId" group-by="false"/>
      <alias entity-alias="OI" name="quantityOrdered" 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>
      </alias>
      <alias entity-alias="OI" name="amount" function="sum">
        <complex-alias operator="*">
          <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>
          <complex-alias-field entity-alias="OI" field="unitPrice" default-value="0"/>
        </complex-alias>
      </alias>
      <view-link entity-alias="OH" rel-entity-alias="OI">
        <key-map field-name="orderId"/>
      </view-link>
      <view-link entity-alias="OH" rel-entity-alias="RL">
        <key-map field-name="orderId"/>
      </view-link>
      <view-link entity-alias="OI" rel-entity-alias="PR">
        <key-map field-name="productId"/>
      </view-link>
      <view-link entity-alias="OH" rel-entity-alias="PS">
        <key-map field-name="productStoreId"/>
      </view-link>
    </view-entity>

    <view-entity entity-name="OrderReportPurchasesGroupByProduct"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Report Group By Product View Entity with extra details for purchase order reporting">
      <member-entity entity-alias="OH" entity-name="OrderHeader"/>
      <member-entity entity-alias="OI" entity-name="OrderItem"/>
      <member-entity entity-alias="RT" entity-name="OrderRole"/>
      <member-entity entity-alias="RF" entity-name="OrderRole"/>
      <member-entity entity-alias="PR" entity-name="Product"/>
      <alias entity-alias="OI" name="productId" group-by="true"/>
      <alias entity-alias="PR" name="internalName" group-by="true"/>
      <alias entity-alias="OH" name="orderDate" group-by="false"/>
      <alias entity-alias="OH" name="orderStatusId" field="statusId" group-by="false"/>
      <alias entity-alias="OI" name="orderItemStatusId" field="statusId" group-by="false"/>
      <alias entity-alias="OH" name="orderTypeId" group-by="false"/>
      <alias entity-alias="RT" name="toPartyId" field="partyId" group-by="false"/>
      <alias entity-alias="RT" name="toRoleTypeId" field="roleTypeId" group-by="false"/>
      <alias entity-alias="RF" name="fromPartyId" field="partyId" group-by="false"/>
      <alias entity-alias="RF" name="fromRoleTypeId" field="roleTypeId" group-by="false"/>
      <alias entity-alias="OI" name="quantity" function="sum"/>
      <alias entity-alias="OI" name="unitPrice" function="sum"/>
      <view-link entity-alias="OH" rel-entity-alias="OI">
        <key-map field-name="orderId"/>
      </view-link>
      <view-link entity-alias="OH" rel-entity-alias="RT"> <!-- to party join -->
        <key-map field-name="orderId"/>
      </view-link>
      <view-link entity-alias="OH" rel-entity-alias="RF"> <!-- from party join -->
        <key-map field-name="orderId"/>
      </view-link>
      <view-link entity-alias="OI" rel-entity-alias="PR"> <!-- product info join -->
        <key-map field-name="productId"/>
      </view-link>
    </view-entity>

    <view-entity entity-name="OrderReportGroupByProduct"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Basic product quantity and price report with ability to select based on order type, status, date and order item status">
      <member-entity entity-alias="OH" entity-name="OrderHeader"/>
      <member-entity entity-alias="OI" entity-name="OrderItem"/>
      <alias entity-alias="OI" name="productId" group-by="true"/>
      <alias entity-alias="OH" name="orderDate" group-by="false"/>
      <alias entity-alias="OH" name="orderStatusId" field="statusId" group-by="false"/>
      <alias entity-alias="OI" name="orderItemStatusId" field="statusId" group-by="false"/>
      <alias entity-alias="OH" name="orderTypeId" group-by="false"/>
      <alias entity-alias="OI" name="quantity" function="sum"/>
      <alias entity-alias="OI" name="unitPrice" function="sum"/>
      <view-link entity-alias="OH" rel-entity-alias="OI">
        <key-map field-name="orderId"/>
      </view-link>
    </view-entity>


  <!-- ========================================================= -->
  <!-- org.apache.ofbiz.order.request -->
  <!-- ========================================================= -->

    <view-entity entity-name="CustRequestAndRole"
            package-name="org.apache.ofbiz.order.request"
            title="Customer Request And Role View Entity">
      <description>See CustRequest for descriptions of date fields</description>
      <member-entity entity-alias="CR" entity-name="CustRequest"/>
      <member-entity entity-alias="CRP" entity-name="CustRequestParty"/>
      <alias entity-alias="CR" name="custRequestId"/>
      <alias entity-alias="CR" name="custRequestTypeId"/>
      <alias entity-alias="CR" name="statusId"/>
      <alias entity-alias="CR" name="fromPartyId"/>
      <alias entity-alias="CR" name="priority"/>
      <alias entity-alias="CR" name="custRequestDate"/>
      <alias entity-alias="CR" name="responseRequiredDate"/>
      <alias entity-alias="CR" name="custRequestName"/>
      <alias entity-alias="CR" name="description"/>
      <alias entity-alias="CR" name="createdDate"/>
      <alias entity-alias="CR" name="lastModifiedDate"/>
      <alias entity-alias="CR" name="lastModifiedByUserLogin"/>
      <alias entity-alias="CRP" name="partyId"/>
      <alias entity-alias="CRP" name="roleTypeId"/>
      <alias entity-alias="CRP" name="fromDate"/>
      <alias entity-alias="CRP" name="thruDate"/>
      <view-link entity-alias="CR" rel-entity-alias="CRP">
        <key-map field-name="custRequestId"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="CustRequest">
        <key-map field-name="custRequestId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="CustRequestParty">
        <key-map field-name="custRequestId"/>
        <key-map field-name="partyId"/>
        <key-map field-name="roleTypeId"/>
        <key-map field-name="fromDate"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="Party">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="Person">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="PartyRole">
        <key-map field-name="partyId"/>
        <key-map field-name="roleTypeId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="RoleType">
        <key-map field-name="roleTypeId"/>
      </relation>
    </view-entity>
    <view-entity entity-name="CustReqAndTypeAndPartyRel"
            package-name="org.apache.ofbiz.order.request"
            title="Customer Request And Role View Entity">
      <member-entity entity-alias="CR" entity-name="CustRequest"/>
      <member-entity entity-alias="CRT" entity-name="CustRequestType"/>
      <member-entity entity-alias="PR" entity-name="PartyRelationship"/>
      <alias-all entity-alias="CR"/>
      <alias entity-alias="CRT" name="typeDescription" field="description"/>
      <alias entity-alias="PR" name="partyIdFrom"/>
      <alias entity-alias="PR" name="roleTypeIdFrom"/>
      <alias entity-alias="PR" name="partyIdTo"/>
      <alias entity-alias="PR" name="roleTypeIdTo"/>
      <alias entity-alias="PR" name="fromDate"/>
      <alias entity-alias="PR" name="thruDate"/>
      <alias entity-alias="PR" name="relStatusId" field="statusId"/>
      <alias entity-alias="PR" name="partyRelationshipTypeId"/>
      <view-link entity-alias="CR" rel-entity-alias="CRT">
        <key-map field-name="custRequestTypeId"/>
      </view-link>
      <view-link entity-alias="CRT" rel-entity-alias="PR" rel-optional="true">
        <key-map field-name="partyId" rel-field-name="partyIdFrom"/>
      </view-link>
    </view-entity>
    <view-entity entity-name="CustRequestAndCommEvent"
            package-name="org.apache.ofbiz.order.request"
            title="Customer Request And CommunicationEvent">
      <member-entity entity-alias="CR" entity-name="CustRequest"/>
      <member-entity entity-alias="CRC" entity-name="CustRequestCommEvent"/>
      <alias-all entity-alias="CR"/>
      <alias entity-alias="CRC" name="communicationEventId"/>
      <view-link entity-alias="CR" rel-entity-alias="CRC">
        <key-map field-name="custRequestId"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="CustRequest">
        <key-map field-name="custRequestId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="CommunicationEvent">
        <key-map field-name="communicationEventId"/>
      </relation>
    </view-entity>
    <view-entity entity-name="CustRequestAndWorkEffort"
            package-name="org.apache.ofbiz.order.request"
            title="Customer Request And WorkEffort">
      <member-entity entity-alias="CRW" entity-name="CustRequestWorkEffort"/>
      <member-entity entity-alias="WE" entity-name="WorkEffort"/>
      <alias-all entity-alias="CRW">
        <exclude field="workEffortId"/>
      </alias-all>
      <alias-all entity-alias="WE"/>
      <view-link entity-alias="CRW" rel-entity-alias="WE">
        <key-map field-name="workEffortId"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="CustRequest">
        <key-map field-name="custRequestId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="WorkEffort">
        <key-map field-name="workEffortId"/>
      </relation>
    </view-entity>
    <view-entity entity-name="CustRequestAndNote"
            package-name="org.apache.ofbiz.order.request"
            title="Customer Request And Note">
      <member-entity entity-alias="CRN" entity-name="CustRequestNote"/>
      <member-entity entity-alias="ND" entity-name="NoteData"/>
      <alias-all entity-alias="CRN">
        <exclude field="noteId"/>
      </alias-all>
      <alias-all entity-alias="ND"/>
      <view-link entity-alias="CRN" rel-entity-alias="ND">
        <key-map field-name="noteId"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="CustRequest">
        <key-map field-name="custRequestId"/>
      </relation>
    </view-entity>
    <view-entity entity-name="CustRequestInfoAndWorkEffortAndPartyRel"
            package-name="org.apache.ofbiz.order.request"
            title="Customer Request And WorkEffort">
      <member-entity entity-alias="CR" entity-name="CustRequest"/>
      <member-entity entity-alias="CRW" entity-name="CustRequestWorkEffort"/>
      <member-entity entity-alias="PR" entity-name="PartyRelationship"/>
      <alias-all entity-alias="CR"/>
      <alias-all entity-alias="CRW">
        <exclude field="custRequestId"/>
      </alias-all>
      <alias entity-alias="PR" name="partyIdFrom"/>
      <alias entity-alias="PR" name="roleTypeIdFrom"/>
      <alias entity-alias="PR" name="partyIdTo"/>
      <alias entity-alias="PR" name="roleTypeIdTo"/>
      <view-link entity-alias="CR" rel-entity-alias="CRW" rel-optional="true">
        <key-map field-name="custRequestId"/>
      </view-link>
      <view-link entity-alias="CR" rel-entity-alias="PR" rel-optional="true">
        <key-map field-name="fromPartyId" rel-field-name="partyIdTo"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="WorkEffort">
        <key-map field-name="workEffortId"/>
      </relation>
    </view-entity>
    <view-entity entity-name="CustRequestNoteView"
            package-name="org.apache.ofbiz.order.request"
            title="Customer Request and Note View Entity">
      <member-entity entity-alias="PR" entity-name="Person"/>
      <member-entity entity-alias="CR" entity-name="CustRequestNote"/>
      <member-entity entity-alias="ND" entity-name="NoteData"/>
      <alias entity-alias="CR" name="custRequestId"/>
      <alias entity-alias="ND" name="noteId"/>
      <alias entity-alias="ND" name="noteName"/>
      <alias entity-alias="ND" name="noteInfo"/>
      <alias entity-alias="ND" name="noteDateTime"/>
      <alias entity-alias="PR" name="noteParty" field="partyId"/>
      <alias entity-alias="PR" name="firstName"/>
      <alias entity-alias="PR" name="lastName"/>
      <view-link entity-alias="CR" rel-entity-alias="ND">
        <key-map field-name="noteId"/>
      </view-link>
      <view-link entity-alias="ND" rel-entity-alias="PR">
        <key-map field-name="noteParty" rel-field-name="partyId"/>
      </view-link>
    </view-entity>
    <view-entity entity-name="CustRequestItemNoteView"
            package-name="org.apache.ofbiz.order.request"
            title="Customer Request Item and Note View Entity">
      <member-entity entity-alias="PR" entity-name="Person"/>
      <member-entity entity-alias="CR" entity-name="CustRequestItemNote"/>
      <member-entity entity-alias="ND" entity-name="NoteData"/>
      <alias entity-alias="CR" name="custRequestId"/>
      <alias entity-alias="CR" name="custRequestItemSeqId"/>
      <alias entity-alias="ND" name="noteId"/>
      <alias entity-alias="ND" name="noteName"/>
      <alias entity-alias="ND" name="noteInfo"/>
      <alias entity-alias="ND" name="noteDateTime"/>
      <alias entity-alias="PR" name="partyId"/>
      <alias entity-alias="PR" name="firstName"/>
      <alias entity-alias="PR" name="lastName"/>
      <view-link entity-alias="CR" rel-entity-alias="ND">
        <key-map field-name="noteId"/>
      </view-link>
      <view-link entity-alias="ND" rel-entity-alias="PR">
        <key-map field-name="noteParty" rel-field-name="partyId"/>
      </view-link>
    </view-entity>
    <view-entity entity-name="QuoteNoteView"
            package-name="org.apache.ofbiz.order.quote"
            never-cache="true"
            title="Quote Note View Entity">
      <member-entity entity-alias="QD" entity-name="QuoteNote"/>
      <member-entity entity-alias="ND" entity-name="NoteData"/>
      <alias entity-alias="QD" name="quoteId"/>
      <alias entity-alias="ND" name="noteId"/>
      <alias entity-alias="ND" name="noteName"/>
      <alias entity-alias="ND" name="noteInfo"/>
      <alias entity-alias="ND" name="noteDateTime"/>
      <alias entity-alias="ND" name="noteParty"/>
      <view-link entity-alias="QD" rel-entity-alias="ND">
        <key-map field-name="noteId"/>
      </view-link>
    </view-entity>
    <view-entity entity-name="QuoteWorkEffortView"
      package-name="org.apache.ofbiz.order.quote"
      title="Quote And Workeffort">
      <description>Shows workefforts for a Quote</description>
      <member-entity entity-alias="QWE" entity-name="QuoteWorkEffort"/>
      <member-entity entity-alias="WE" entity-name="WorkEffort"/>
      <member-entity entity-alias="SI" entity-name="StatusItem"/>
      <alias-all entity-alias="QWE"/>
      <alias-all entity-alias="WE"/>
      <!--alias name="statusId" field="statusId" entity-alias="SI"/-->
      <alias name="statusItemDescription" field="description" entity-alias="SI"/>
      <view-link entity-alias="QWE" rel-entity-alias="WE">
        <key-map field-name="workEffortId"/>
      </view-link>
      <view-link entity-alias="WE" rel-entity-alias="SI" rel-optional="true">
        <key-map field-name="currentStatusId" rel-field-name="statusId"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="WorkEffort">
        <key-map field-name="workEffortId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="Quote">
        <key-map field-name="quoteId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="StatusItem">
        <key-map field-name="currentStatusId" rel-field-name="statusId"/>
      </relation>
    </view-entity>
    <view-entity entity-name="RequirementAndRole"
            package-name="org.apache.ofbiz.order.request"
            title="Requirement And Role View Entity">
      <member-entity entity-alias="RQ" entity-name="Requirement"/>
      <member-entity entity-alias="RQR" entity-name="RequirementRole"/>
      <alias entity-alias="RQ" name="requirementId"/>
      <alias entity-alias="RQ" name="requirementTypeId"/>
      <alias entity-alias="RQ" name="statusId"/>
      <alias entity-alias="RQ" name="facilityId"/>
      <alias entity-alias="RQ" name="deliverableId"/>
      <alias entity-alias="RQ" name="fixedAssetId"/>
      <alias entity-alias="RQ" name="productId"/>
      <alias entity-alias="RQ" name="description"/>
      <alias entity-alias="RQ" name="requirementStartDate"/>
      <alias entity-alias="RQ" name="requiredByDate"/>
      <alias entity-alias="RQ" name="estimatedBudget"/>
      <alias entity-alias="RQ" name="quantity"/>
      <alias entity-alias="RQ" name="reason"/>
      <alias entity-alias="RQ" name="lastModifiedDate"/>
      <alias entity-alias="RQ" name="lastModifiedByUserLogin"/>
      <alias entity-alias="RQR" name="partyId"/>
      <alias entity-alias="RQR" name="roleTypeId"/>
      <alias entity-alias="RQR" name="fromDate"/>
      <alias entity-alias="RQR" name="thruDate"/>
      <view-link entity-alias="RQ" rel-entity-alias="RQR" rel-optional="true">
        <key-map field-name="requirementId"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="Requirement">
        <key-map field-name="requirementId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="RequirementRole">
        <key-map field-name="requirementId"/>
        <key-map field-name="partyId"/>
        <key-map field-name="roleTypeId"/>
        <key-map field-name="fromDate"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="Party">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="Person">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="PartyRole">
        <key-map field-name="partyId"/>
        <key-map field-name="roleTypeId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="RoleType">
        <key-map field-name="roleTypeId"/>
      </relation>
    </view-entity>
    <view-entity entity-name="RequirementCustRequestView"
            package-name="org.apache.ofbiz.order.request"
            title="Requirement Customer Request View Entity">
      <member-entity entity-alias="RR" entity-name="RequirementCustRequest"/>
      <member-entity entity-alias="RQ" entity-name="Requirement"/>
      <member-entity entity-alias="RI" entity-name="CustRequestItem"/>
      <alias entity-alias="RR" name="custRequestId"/>
      <alias entity-alias="RR" name="custRequestItemSeqId"/>
      <alias entity-alias="RR" name="requirementId"/>
      <alias entity-alias="RQ" name="requirementTypeId"/>
      <alias entity-alias="RQ" name="description"/>
      <alias entity-alias="RQ" name="productId"/>
      <alias entity-alias="RQ" name="estimatedBudget"/>
      <alias entity-alias="RQ" name="quantity"/>
      <alias entity-alias="RQ" name="requirementStartDate"/>
      <alias entity-alias="RQ" name="requiredByDate"/>
      <alias entity-alias="RI" name="statusId"/>
      <alias entity-alias="RI" name="priority"/>
      <alias entity-alias="RI" name="maximumAmount"/>
      <view-link entity-alias="RR" rel-entity-alias="RQ">
        <key-map field-name="requirementId"/>
      </view-link>
      <view-link entity-alias="RR" rel-entity-alias="RI">
        <key-map field-name="custRequestId"/>
        <key-map field-name="custRequestItemSeqId"/>
      </view-link>
    </view-entity>
    <view-entity entity-name="RequirementByProductFacility"
            package-name="org.apache.ofbiz.order.request"
            title="Sum of Requirement entity quantities, grouped by productId, facilityId, statusId">
      <member-entity entity-alias="RQ" entity-name="Requirement"/>
      <alias entity-alias="RQ" name="statusId" group-by="true"/>
      <alias entity-alias="RQ" name="productId" group-by="true"/>
      <alias entity-alias="RQ" name="facilityId" group-by="true"/>
      <alias entity-alias="RQ" name="quantity" function="sum"/>
    </view-entity>
    <view-entity entity-name="RequirementPartyProductCount"
            package-name="org.apache.ofbiz.order.request"
            title="A join on Requirement and RequirementRole to count number of distinct products required from a supplier party">
      <member-entity entity-alias="RQ" entity-name="Requirement"/>
      <member-entity entity-alias="RQR" entity-name="RequirementRole"/>
      <alias entity-alias="RQ" name="requirementTypeId" group-by="false"/>
      <alias entity-alias="RQ" name="statusId" group-by="false"/>
      <alias entity-alias="RQ" name="productId" function="count-distinct"/>
      <alias entity-alias="RQR" name="partyId" group-by="true"/>
      <alias entity-alias="RQR" name="roleTypeId" group-by="false"/>
      <alias entity-alias="RQR" name="fromDate" group-by="false"/>
      <alias entity-alias="RQR" name="thruDate" group-by="false"/>
      <view-link entity-alias="RQ" rel-entity-alias="RQR">
        <key-map field-name="requirementId"/>
      </view-link>
    </view-entity>
    <view-entity entity-name="CustRequestAndContent"
      package-name="org.apache.ofbiz.order.request"
      title="Customer Request And Content View Entity">
      <description>Show Content of CustRequest</description>
      <member-entity entity-alias="CRC" entity-name="CustRequestContent"/>
      <member-entity entity-alias="CT" entity-name="Content"/>
      <alias-all entity-alias="CRC">
        <exclude field="contentId"/>
      </alias-all>
      <alias-all entity-alias="CT"/>
      <view-link entity-alias="CRC" rel-entity-alias="CT">
        <key-map field-name="contentId"/>
      </view-link>
    </view-entity>

  <!-- ========================================================= -->
  <!-- org.apache.ofbiz.order.communication -->
  <!-- ========================================================= -->

    <view-entity entity-name="CommunicationEventAndOrder"
                 package-name="org.apache.ofbiz.order.communication"
                 title="Communication Event And Order View Entity">
      <member-entity entity-alias="CO" entity-name="CommunicationEventOrder"/>
      <member-entity entity-alias="CE" entity-name="CommunicationEvent"/>
      <alias-all entity-alias="CO"/>
      <alias-all entity-alias="CE"/>
      <view-link entity-alias="CO" rel-entity-alias="CE">
        <key-map field-name="communicationEventId"/>
      </view-link>
    </view-entity>
    <view-entity entity-name="CommunicationEventAndCustRequest"
                 package-name="org.apache.ofbiz.order.communication"
                 title="Communication Event And Customer request">
      <member-entity entity-alias="CR" entity-name="CustRequestCommEvent"/>
      <member-entity entity-alias="CE" entity-name="CommunicationEvent"/>
      <alias-all entity-alias="CR"/>
      <alias-all entity-alias="CE"/>
      <view-link entity-alias="CR" rel-entity-alias="CE">
        <key-map field-name="communicationEventId"/>
      </view-link>
    </view-entity>
    
    <view-entity entity-name="CommunicationEventAndReturn"
                 package-name="org.apache.ofbiz.return.communication"
                 title="Communication Event And Return View Entity">
      <member-entity entity-alias="CR" entity-name="CommunicationEventReturn"/>
      <member-entity entity-alias="CE" entity-name="CommunicationEvent"/>
      <alias-all entity-alias="CR"/>
      <alias-all entity-alias="CE"/>
      <view-link entity-alias="CR" rel-entity-alias="CE">
        <key-map field-name="communicationEventId"/>
      </view-link>
    </view-entity>
    
    <view-entity entity-name="OrderItemAndShipGrpInvResAndItemSum"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Item and Inventory Reservation View Entity">
      <member-entity entity-alias="OI" entity-name="OrderItem"/>
      <member-entity entity-alias="OISGIR" entity-name="OrderItemShipGrpInvRes"/>
      <member-entity entity-alias="II" entity-name="InventoryItem"/>
      <alias entity-alias="OI" name="orderId" group-by="true"/>
      <alias entity-alias="OI" name="orderItemSeqId" group-by="true"/>
      <alias entity-alias="OI" name="productId" group-by="true"/>
      <alias entity-alias="II" name="inventoryProductId" field="productId" group-by="true"/>
      <alias entity-alias="OISGIR" name="shipGroupSeqId" group-by="true"/>
      <alias entity-alias="OI" name="quantityOrdered" 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>
      </alias>
      <alias entity-alias="OISGIR" name="totQuantityReserved" field="quantity" function="sum"/>
      <alias entity-alias="OISGIR" name="totQuantityNotAvailable" field="quantityNotAvailable" function="sum"/>
      <alias entity-alias="OISGIR" name="totQuantityAvailable" function="sum">
          <complex-alias operator="-">
              <complex-alias-field entity-alias="OISGIR" field="quantity" default-value="0"/>
              <complex-alias-field entity-alias="OISGIR" field="quantityNotAvailable" default-value="0"/>
          </complex-alias>
      </alias>
      <view-link entity-alias="OI" rel-entity-alias="OISGIR">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </view-link>
      <view-link entity-alias="OISGIR" rel-entity-alias="II">
        <key-map field-name="inventoryItemId"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="Product">
        <key-map field-name="productId"/>
      </relation>
    </view-entity>

  <view-entity entity-name="OrderHeaderAndWorkEffort"
          package-name="org.apache.ofbiz.order.order" 
          title="Order Header And Work Effort View Entity">
    <member-entity entity-alias="WE" entity-name="WorkEffort"/>
    <member-entity entity-alias="OH" entity-name="OrderHeader"/>
    <member-entity entity-alias="OHWE" entity-name="OrderHeaderWorkEffort"/>
    <alias-all entity-alias="WE"/>
    <alias-all entity-alias="OH">
        <exclude field="priority"/>
    </alias-all>
    <alias-all entity-alias="OHWE"/>
    <view-link entity-alias="WE" rel-entity-alias="OHWE">
      <key-map field-name="workEffortId"/>
    </view-link>
    <view-link entity-alias="OHWE" rel-entity-alias="OH">
      <key-map field-name="orderId"/>
    </view-link>
  </view-entity>

    <view-entity entity-name="OrderItemBillingAndInvoiceAndItem"
          package-name="org.apache.ofbiz.order.order" 
          title="OrderItemBilling and Invoice and InvoiceItem View Entity">
    <member-entity entity-alias="OIB" entity-name="OrderItemBilling"/>
    <member-entity entity-alias="INV" entity-name="Invoice"/>
    <member-entity entity-alias="II" entity-name="InvoiceItem"/>
    <alias-all entity-alias="OIB"/>
    <alias entity-alias="INV" name="statusId"/>
    <view-link entity-alias="OIB" rel-entity-alias="INV">
      <key-map field-name="invoiceId"/>
    </view-link>
    <view-link entity-alias="OIB" rel-entity-alias="II">
      <key-map field-name="invoiceId"/>
      <key-map field-name="invoiceItemSeqId"/>
    </view-link>
    <relation type="one-nofk" rel-entity-name="Invoice">
        <key-map field-name="invoiceId"/>
    </relation>
    <relation type="one" rel-entity-name="InvoiceItem">
        <key-map field-name="invoiceId"/>
        <key-map field-name="invoiceItemSeqId"/>
    </relation>
  </view-entity>

  <view-entity entity-name="OrderItemAndProduct"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="OrderItem And Product View Entity">
      <member-entity entity-alias="OI" entity-name="OrderItem"/>
      <member-entity entity-alias="PR" entity-name="Product"/>
      <alias-all entity-alias="OI"/>
      <alias-all entity-alias="PR">
        <exclude field="comments"/>
      </alias-all>
      <view-link entity-alias="OI" rel-entity-alias="PR">
        <key-map field-name="productId"/>
      </view-link>
      <relation type="one-nofk" rel-entity-name="Product">
        <key-map field-name="productId"/>
      </relation>
  </view-entity>
  
  <view-entity entity-name="WorkAndOrderItemFulfillment"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="WorkOrderItemFulfillment And WorkEffort View Entity">
      <member-entity entity-alias="WOIF" entity-name="WorkOrderItemFulfillment"/>
      <member-entity entity-alias="WE" entity-name="WorkEffort"/>
      <alias-all entity-alias="WOIF"/>
      <alias-all entity-alias="WE"/>
      <view-link rel-entity-alias="WE" entity-alias="WOIF">
        <key-map field-name="workEffortId"/>
      </view-link>
  </view-entity>
  <view-entity entity-name="OrderAndPartyContactMech"
           package-name="org.apache.ofbiz.party.party"
           title="Order contact mech and purpose view">
    <member-entity entity-alias="OCM" entity-name="OrderContactMech"/>
    <member-entity entity-alias="CM" entity-name="ContactMech"/>
    <member-entity entity-alias="PCM" entity-name="PartyContactMech"/>
    <alias-all entity-alias="OCM"/>
    <alias entity-alias="PCM" name="partyId"/>
    <alias entity-alias="PCM" name="contactFromDate" field="fromDate"/>
    <alias entity-alias="PCM" name="contactThruDate" field="thruDate"/>
    <alias entity-alias="CM" name="contactMechTypeId"/>
    <alias entity-alias="CM" name="infoString"/>
    <alias entity-alias="PCM" name="comments"/>
    <alias entity-alias="PCM" name="extension"/>
    <alias entity-alias="PCM" name="allowSolicitation"/>
    <view-link entity-alias="OCM" rel-entity-alias="CM">
      <key-map field-name="contactMechId"/>
    </view-link>
    <view-link entity-alias="CM" rel-entity-alias="PCM">
      <key-map field-name="contactMechId"/>
    </view-link>
  </view-entity>
</entitymodel>
