<?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="http://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.quote -->
    <!--  - org.apache.ofbiz.order.request -->
    <!--  - org.apache.ofbiz.order.requirement -->
    <!--  - org.apache.ofbiz.order.return -->
    <!--  - org.apache.ofbiz.order.shoppingcart -->
    <!--  - org.apache.ofbiz.order.shoppinglist -->
    <!--  - org.apache.ofbiz.order.opportunity -->
    <!-- ========================================================= -->


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

    <entity entity-name="OrderAdjustment"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Adjustment">
      <description>Note that both includeInTax and includeInShipping should default to true, except in the case where this adjustment is a tax or shipping adjustment then should be ignored.</description>
      <field name="orderAdjustmentId" type="id"></field>
      <field name="orderAdjustmentTypeId" type="id"></field>
      <field name="orderId" type="id"></field>
      <field name="orderItemSeqId" type="id"></field>
      <field name="shipGroupSeqId" type="id"></field>
      <field name="comments" type="comment"></field>
      <field name="description" type="description"></field>
      <field name="amount" type="currency-precise"></field>
      <field name="recurringAmount" type="currency-precise"></field>
      <field name="amountAlreadyIncluded" type="currency-precise"><description>The amount here is already represented in the price, such as VAT taxes.</description></field>
      <field name="productPromoId" type="id"></field>
      <field name="productPromoRuleId" type="id"></field>
      <field name="productPromoActionSeqId" type="id"></field>
      <field name="productFeatureId" type="id"></field>
      <field name="correspondingProductId" type="id"></field>
      <field name="taxAuthorityRateSeqId" type="id"></field>
      <field name="sourceReferenceId" type="id-long"></field>
      <field name="sourcePercentage" type="fixed-point">
          <description>for tax entries this is the tax percentage</description>
      </field>
      <field name="customerReferenceId" type="id-long">
          <description>for tax entries this is partyTaxId</description>
      </field>
      <field name="primaryGeoId" type="id">
          <description>for tax entries this is the primary jurisdiction Geo (the smallest or most local Geo that this tax is for, usually a state/province, perhaps a county or a city)</description>
       </field>
      <field name="secondaryGeoId" type="id">
          <description>for tax entries this is the secondary jurisdiction Geo (usually a country, or other Geo that the primary is within)</description>
      </field>
      <field name="exemptAmount" type="currency-amount">
          <description>an amount that would normally apply, but not to this order; for tax exemption represents the what the tax would have been</description>
      </field>
      <field name="taxAuthGeoId" type="id">
          <description>these taxAuth fields deprecate the primaryGeoId and secondaryGeoId fields and will be used with the newer tax calc stuff</description>
      </field>
      <field name="taxAuthPartyId" type="id"></field>
      <field name="overrideGlAccountId" type="id">
          <description>used to specify the override or actual glAccountId used for the adjustment, avoids problems if configuration changes after initial posting, etc</description>
      </field>
      <field name="includeInTax" type="indicator"></field>
      <field name="includeInShipping" type="indicator"></field>
      <field name="isManual" type="indicator"></field>
      <field name="createdDate" type="date-time"></field>
      <field name="createdByUserLogin" type="id-vlong"></field>
      <field name="lastModifiedDate" type="date-time"></field>
      <field name="lastModifiedByUserLogin" type="id-vlong"></field>
      <field name="originalAdjustmentId" type="id">
          <description>specifies relation to source OrderAdjustment - eg. for tax on shipping charges</description>
      </field>
      <!-- old fields, deprecated -->
        <field name="oldAmountPerQuantity" col-name="AMOUNT_PER_QUANTITY" type="currency-amount"></field>
        <field name="oldPercentage" col-name="PERCENTAGE" type="floating-point"></field>
      <prim-key field="orderAdjustmentId"/>
      <relation type="one" fk-name="ORDER_ADJ_TYPE" rel-entity-name="OrderAdjustmentType">
        <key-map field-name="orderAdjustmentTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderAdjustmentTypeAttr">
        <key-map field-name="orderAdjustmentTypeId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ADJ_OHEAD" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ADJ_USERL" rel-entity-name="UserLogin">
        <key-map field-name="createdByUserLogin" rel-field-name="userLoginId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="OrderItemShipGroup">
        <key-map field-name="orderId"/>
        <key-map field-name="shipGroupSeqId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="OrderItemShipGroupAssoc">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
        <key-map field-name="shipGroupSeqId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ADJ_PROMO" rel-entity-name="ProductPromo">
        <key-map field-name="productPromoId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="ProductPromoRule">
        <key-map field-name="productPromoId"/>
        <key-map field-name="productPromoRuleId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="ProductPromoAction">
        <key-map field-name="productPromoId"/>
        <key-map field-name="productPromoRuleId"/>
        <key-map field-name="productPromoActionSeqId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ADJ_PRGEO" title="Primary" rel-entity-name="Geo">
        <key-map field-name="primaryGeoId" rel-field-name="geoId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ADJ_SCGEO" title="Secondary" rel-entity-name="Geo">
        <key-map field-name="secondaryGeoId" rel-field-name="geoId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ADJ_TXA" rel-entity-name="TaxAuthority">
        <key-map field-name="taxAuthGeoId"/>
        <key-map field-name="taxAuthPartyId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ADJ_OGLA" title="Override" rel-entity-name="GlAccount">
        <key-map field-name="overrideGlAccountId" rel-field-name="glAccountId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ADJ_TARP" rel-entity-name="TaxAuthorityRateProduct">
        <key-map field-name="taxAuthorityRateSeqId"/>
      </relation>
      <relation type="one-nofk" fk-name="ORDER_ADJ_OA" rel-entity-name="OrderAdjustment">
        <key-map field-name="originalAdjustmentId" rel-field-name="orderAdjustmentId"/>
      </relation>
    </entity>
    <entity entity-name="OrderAdjustmentAttribute"
            package-name="org.apache.ofbiz.order.order"
            title="Order Adjustment Attribute">
      <field name="orderAdjustmentId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="attrValue" type="value"></field>
      <field name="attrDescription" type="description"></field>
      <prim-key field="orderAdjustmentId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="ORDER_ADJ_ATTR" rel-entity-name="OrderAdjustment">
        <key-map field-name="orderAdjustmentId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderAdjustmentTypeAttr">
        <key-map field-name="attrName"/>
      </relation>
    </entity>
    <entity entity-name="OrderAdjustmentType"
            package-name="org.apache.ofbiz.order.order"
            default-resource-name="OrderEntityLabels"
            title="Order Adjustment Type">
      <field name="orderAdjustmentTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="orderAdjustmentTypeId"/>
      <relation type="one" fk-name="ORDER_ADJ_TYPPAR" title="Parent" rel-entity-name="OrderAdjustmentType">
        <key-map field-name="parentTypeId" rel-field-name="orderAdjustmentTypeId"/>
      </relation>
    </entity>
    <entity entity-name="OrderAdjustmentBilling"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Adjustment Billing">
      <field name="orderAdjustmentId" type="id"></field>
      <field name="invoiceId" type="id"></field>
      <field name="invoiceItemSeqId" type="id"></field>
      <field name="amount" type="currency-amount"></field>
      <prim-key field="orderAdjustmentId"/>
      <prim-key field="invoiceId"/>
      <prim-key field="invoiceItemSeqId"/>
      <relation type="one" fk-name="ORDER_ADJBLNG_OA" rel-entity-name="OrderAdjustment">
        <key-map field-name="orderAdjustmentId"/>
      </relation>
      <relation type="one-nofk" fk-name="ORDER_ADJBLNG_INV" rel-entity-name="Invoice">
        <key-map field-name="invoiceId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ADJBLNG_IITM" rel-entity-name="InvoiceItem">
        <key-map field-name="invoiceId"/>
        <key-map field-name="invoiceItemSeqId"/>
      </relation>
    </entity>
    <entity entity-name="OrderAdjustmentTypeAttr"
            package-name="org.apache.ofbiz.order.order"
            title="Order Adjustment Type Attribute">
      <field name="orderAdjustmentTypeId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="description" type="description"></field>
      <prim-key field="orderAdjustmentTypeId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="ORDER_ADJ_TYPATTR" rel-entity-name="OrderAdjustmentType">
        <key-map field-name="orderAdjustmentTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderAdjustmentAttribute">
        <key-map field-name="attrName"/>
      </relation>
      <relation type="many" rel-entity-name="OrderAdjustment">
        <key-map field-name="orderAdjustmentTypeId"/>
      </relation>
    </entity>
    <entity entity-name="OrderAttribute"
            package-name="org.apache.ofbiz.order.order"
            title="Order Attribute">
      <field name="orderId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="attrValue" type="value"></field>
      <field name="attrDescription" type="description"></field>
      <prim-key field="orderId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="ORDER_ATTR_HDR" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderTypeAttr">
        <key-map field-name="attrName"/>
      </relation>
    </entity>
    <entity entity-name="OrderBlacklist"
            package-name="org.apache.ofbiz.order.order"
            title="Order Blacklist">
      <field name="blacklistString" type="long-varchar"></field>
      <field name="orderBlacklistTypeId" type="id"></field>
      <prim-key field="blacklistString"/>
      <prim-key field="orderBlacklistTypeId"/>
      <relation type="one" fk-name="ORDER_BKL_TYPE" rel-entity-name="OrderBlacklistType">
        <key-map field-name="orderBlacklistTypeId"/>
      </relation>
    </entity>
    <entity entity-name="OrderBlacklistType"
            package-name="org.apache.ofbiz.order.order"
            default-resource-name="OrderEntityLabels"
            title="Order Blacklist Type">
      <field name="orderBlacklistTypeId" type="id"></field>
      <field name="description" type="description"></field>
      <prim-key field="orderBlacklistTypeId"/>
    </entity>
     <entity entity-name="CommunicationEventOrder"
            package-name="org.apache.ofbiz.order.order"
            title="Communication Event Order">
      <field name="orderId" type="id"></field>
      <field name="communicationEventId" type="id"></field>
      <prim-key field="orderId"/>
      <prim-key field="communicationEventId"/>
      <relation type="one" fk-name="COMEV_ORDER_ORDER" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one" fk-name="COMEV_ORDER_CMEV" rel-entity-name="CommunicationEvent">
        <key-map field-name="communicationEventId"/>
      </relation>
    </entity>
    <entity entity-name="OrderContactMech"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Contact Mechanism">
      <field name="orderId" type="id"></field>
      <field name="contactMechPurposeTypeId" type="id"></field>
      <field name="contactMechId" type="id"></field>
      <prim-key field="orderId"/>
      <prim-key field="contactMechPurposeTypeId"/>
      <prim-key field="contactMechId"/>
      <relation type="one" fk-name="ORDER_CMECH_HDR" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one" fk-name="ORDER_CMECH_CM" rel-entity-name="ContactMech">
        <key-map field-name="contactMechId"/>
      </relation>
      <relation type="one" fk-name="ORDER_CMECH_CMPT" rel-entity-name="ContactMechPurposeType">
        <key-map field-name="contactMechPurposeTypeId"/>
      </relation>
    </entity>
    <entity entity-name="OrderContent" package-name="org.apache.ofbiz.order.order" title="Order Data Object">
        <field name="orderId" type="id"></field>
        <field name="orderItemSeqId" type="id"></field>
        <field name="contentId" type="id"></field>
        <field name="orderContentTypeId" type="id"></field>
        <field name="fromDate" type="date-time"></field>
        <field name="thruDate" type="date-time"></field>
        <prim-key field="contentId"/>
        <prim-key field="orderId"/>
        <prim-key field="orderItemSeqId"/>
        <prim-key field="orderContentTypeId"/>
        <prim-key field="fromDate"/>
        <relation type="one" fk-name="ORD_CNT_PROD" rel-entity-name="OrderHeader">
            <key-map field-name="orderId"/>
        </relation>
        <relation type="one" fk-name="ORD_CNT_CNT" rel-entity-name="Content">
            <key-map field-name="contentId"/>
        </relation>
        <relation type="one" fk-name="ORD_CNT_TYPE" rel-entity-name="OrderContentType">
            <key-map field-name="orderContentTypeId"/>
        </relation>
    </entity>
    <entity entity-name="OrderContentType" package-name="org.apache.ofbiz.order.order" default-resource-name="OrderEntityLabels"
        title="Order Content Type">
        <field name="orderContentTypeId" type="id"></field>
        <field name="parentTypeId" type="id"></field>
        <field name="hasTable" type="indicator"></field>
        <field name="description" type="description"></field>
        <prim-key field="orderContentTypeId"/>
        <relation type="one" fk-name="ORDCT_TYP_PARENT" title="Parent" rel-entity-name="OrderContentType">
            <key-map field-name="parentTypeId" rel-field-name="orderContentTypeId"/>
        </relation>
    </entity>
    <entity entity-name="OrderDeliverySchedule"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="The Order Delivery Schedule">
      <field name="orderId" type="id"></field>
      <field name="orderItemSeqId" type="id"></field>
      <field name="estimatedReadyDate" type="date-time"></field>
      <field name="cartons" type="numeric"></field>
      <field name="skidsPallets" type="numeric"></field>
      <field name="unitsPieces" type="fixed-point"></field>
      <field name="totalCubicSize" type="fixed-point"></field>
      <field name="totalCubicUomId" type="id"></field>
      <field name="totalWeight" type="fixed-point"></field>
      <field name="totalWeightUomId" type="id"></field>
      <field name="statusId" type="id"></field>
      <prim-key field="orderId"/>
      <prim-key field="orderItemSeqId"/>
      <relation type="one" fk-name="ORDER_DELSCH_OHDR" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
      <relation type="one" fk-name="ORDER_DELSCH_TCUOM" title="TotalCubic" rel-entity-name="Uom">
        <key-map field-name="totalCubicUomId" rel-field-name="uomId"/>
      </relation>
      <relation type="one" fk-name="ORDER_DELSCH_TWUOM" title="TotalWeight" rel-entity-name="Uom">
        <key-map field-name="totalWeightUomId" rel-field-name="uomId"/>
      </relation>
      <relation type="one" fk-name="ORDER_DELSCH_STTS" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
    </entity>
    <entity entity-name="OrderHeader"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Header">
      <field name="orderId" type="id"></field>
      <field name="orderTypeId" type="id"></field>
      <field name="orderName" type="name"></field>
      <field name="externalId" type="id"></field>
      <field name="salesChannelEnumId" type="id"></field>
      <field name="orderDate" type="date-time"></field>
      <field name="priority" type="indicator"><description>Sets priority for Inventory Reservation</description></field>
      <field name="entryDate" type="date-time"></field>
      <field name="pickSheetPrintedDate" type="date-time"><description>This will be set to a date when pick sheet of the order is printed</description></field>
      <field name="visitId" type="id"></field>
      <field name="statusId" type="id"></field>
      <field name="createdBy" type="id-vlong"></field>
      <field name="firstAttemptOrderId" type="id"></field>
      <field name="currencyUom" type="id"></field>
      <field name="syncStatusId" type="id"></field>
      <field name="billingAccountId" type="id"></field>
      <field name="originFacilityId" type="id"></field>
      <field name="webSiteId" type="id"></field>
      <field name="productStoreId" type="id"></field>
      <field name="agreementId" type="id"/>
      <field name="terminalId" type="id-long"></field>
      <field name="transactionId" type="id-long"></field>
      <field name="autoOrderShoppingListId" type="id"></field>
      <field name="needsInventoryIssuance" type="indicator"></field>
      <field name="isRushOrder" type="indicator"></field>
      <field name="internalCode" type="id-long"></field>
      <field name="remainingSubTotal" type="currency-amount"></field>
      <field name="grandTotal" type="currency-amount"></field>
      <field name="isViewed" type="indicator"></field>
      <field name="invoicePerShipment" type="indicator"></field>
      <prim-key field="orderId"/>
      <relation type="one" fk-name="ORDER_HDR_TYPE" rel-entity-name="OrderType">
        <key-map field-name="orderTypeId"/>
      </relation>
      <relation type="one" fk-name="ORDER_HDR_SCENUM" title="SalesChannel" rel-entity-name="Enumeration">
        <key-map field-name="salesChannelEnumId" rel-field-name="enumId"/>
      </relation>
      <relation type="one" fk-name="ORDER_HDR_OFAC" 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="one" fk-name="ORDER_HDR_BACCT" rel-entity-name="BillingAccount">
        <key-map field-name="billingAccountId"/>
      </relation>
      <relation type="one" fk-name="ORDER_HDR_PDSTR" rel-entity-name="ProductStore">
        <key-map field-name="productStoreId"/>
      </relation>
      <relation type="one" fk-name="ORDER_HDR_AOSHLST" title="AutoOrder" rel-entity-name="ShoppingList">
        <key-map field-name="autoOrderShoppingListId" rel-field-name="shoppingListId"/>
      </relation>
      <relation type="one" fk-name="ORDER_HDR_CBUL" title="CreatedBy" rel-entity-name="UserLogin">
        <key-map field-name="createdBy" rel-field-name="userLoginId"/>
      </relation>
      <relation type="one" fk-name="ORDER_HDR_STTS" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
      <relation type="one" fk-name="ORDER_HDR_SYST" title="Sync" rel-entity-name="StatusItem">
        <key-map field-name="syncStatusId" rel-field-name="statusId"/>
      </relation>
      <relation type="one" fk-name="ORDER_HDR_CUOM" rel-entity-name="Uom">
        <key-map field-name="currencyUom" rel-field-name="uomId"/>
      </relation>
      <relation type="one" fk-name="ORDER_HDR_WS" rel-entity-name="WebSite">
        <key-map field-name="webSiteId"/>
      </relation>
      <index name="ORDEREXT_ID_IDX">
        <index-field name="externalId"/>
      </index>
    </entity>
    <entity entity-name="OrderHeaderNote"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Header Note">
      <field name="orderId" type="id"></field>
      <field name="noteId" type="id"></field>
      <field name="internalNote" type="indicator"></field>
      <prim-key field="orderId"/>
      <prim-key field="noteId"/>
      <relation type="one" fk-name="ORDER_HDRNT_HDR" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one" fk-name="ORDER_HDRNT_NOTE" rel-entity-name="NoteData">
        <key-map field-name="noteId"/>
      </relation>
    </entity>
    <entity entity-name="OrderHeaderWorkEffort"
            package-name="org.apache.ofbiz.order.order"
            title="OrderHeader WorkEffort">
        <field name="orderId" type="id"></field>
        <field name="workEffortId" type="id"></field>
        <prim-key field="orderId"/>
        <prim-key field="workEffortId"/>
        <relation type="one" fk-name="ORDERHDWE_OH" rel-entity-name="OrderHeader">
            <key-map field-name="orderId"/>
        </relation>
        <relation type="one" fk-name="ORDERHDWE_WEFF" rel-entity-name="WorkEffort">
            <key-map field-name="workEffortId"/>
        </relation>
    </entity>
    <entity entity-name="OrderItem"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Item">
      <field name="orderId" type="id"></field>
      <field name="orderItemSeqId" type="id"></field>
      <field name="externalId" type="id"></field>
      <field name="orderItemTypeId" type="id"></field>
      <field name="orderItemGroupSeqId" type="id"></field>
      <field name="isItemGroupPrimary" type="indicator"></field>
      <field name="fromInventoryItemId" type="id"></field>
      <field name="budgetId" type="id"></field>
      <field name="budgetItemSeqId" type="id"></field>
      <field name="productId" type="id"></field>
      <field name="supplierProductId" type="id-long"></field>
      <field name="productFeatureId" type="id"></field>
      <field name="prodCatalogId" type="id"></field>
      <field name="productCategoryId" type="id"></field>
      <field name="isPromo" type="indicator"></field>
      <field name="quoteId" type="id"></field>
      <field name="quoteItemSeqId" type="id"></field>
      <field name="shoppingListId" type="id"></field>
      <field name="shoppingListItemSeqId" type="id"></field>
      <field name="subscriptionId" type="id"></field>
      <field name="deploymentId" type="id"></field>
      <field name="quantity" type="fixed-point" enable-audit-log="true"></field>
      <field name="cancelQuantity" type="fixed-point"></field>
      <field name="selectedAmount" type="fixed-point"></field>
      <field name="unitPrice" type="currency-precise" enable-audit-log="true"></field>
      <field name="unitListPrice" type="currency-precise"></field>
      <field name="unitAverageCost" type="currency-amount"></field>
      <field name="unitRecurringPrice" type="currency-amount"></field>
      <field name="isModifiedPrice" type="indicator"></field>
      <field name="recurringFreqUomId" type="id"></field>
      <field name="itemDescription" type="description"></field>
      <field name="comments" type="comment"></field>
      <field name="correspondingPoId" type="id"></field>
      <field name="statusId" type="id"></field>
      <field name="syncStatusId" type="id"></field>
      <field name="estimatedShipDate" type="date-time"></field>
      <field name="estimatedDeliveryDate" type="date-time"></field>
      <field name="autoCancelDate" type="date-time"></field>
      <field name="dontCancelSetDate" type="date-time"></field>
      <field name="dontCancelSetUserLogin" type="id-vlong"></field>
      <field name="shipBeforeDate" type="date-time"></field>
      <field name="shipAfterDate" type="date-time"></field>
      <field name="cancelBackOrderDate" type="date-time"><description>Used to cancel all orders from suppliers when its in past</description></field>
      <field name="overrideGlAccountId" type="id"><description>Used to specify the override or actual glAccountId used for the adjustment, avoids problems if configuration changes after initial posting, etc.</description></field>
      <field name="salesOpportunityId" type="id"></field>
      <field name="changeByUserLoginId" type="id-vlong" enable-audit-log="true"></field>
      <prim-key field="orderId"/>
      <prim-key field="orderItemSeqId"/>
      <relation type="one" fk-name="ORDER_ITEM_HDR" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITEM_ORTYP" rel-entity-name="OrderItemType">
        <key-map field-name="orderItemTypeId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITEM_ITGRP" rel-entity-name="OrderItemGroup">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemGroupSeqId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItemTypeAttr">
        <key-map field-name="orderItemTypeId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITEM_PRODUCT" rel-entity-name="Product">
        <key-map field-name="productId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITEM_FMINV" title="From" rel-entity-name="InventoryItem">
        <key-map field-name="fromInventoryItemId" rel-field-name="inventoryItemId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITEM_RFUOM" title="RecurringFreq" rel-entity-name="Uom">
        <key-map field-name="recurringFreqUomId" rel-field-name="uomId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITEM_STTS" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
      <relation type="many" rel-entity-name="ProductFacilityLocation">
        <key-map field-name="productId"/>
      </relation>
      <relation type="many" rel-entity-name="StatusValidChange">
        <key-map field-name="statusId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITEM_SYST" title="Sync" rel-entity-name="StatusItem">
        <key-map field-name="syncStatusId" rel-field-name="statusId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITEM_DCUL" title="DontCancelSet" rel-entity-name="UserLogin">
        <key-map field-name="dontCancelSetUserLogin" rel-field-name="userLoginId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITEM_QUIT" rel-entity-name="QuoteItem">
        <key-map field-name="quoteId"/>
        <key-map field-name="quoteItemSeqId"/>
      </relation>
      <relation type="one-nofk" fk-name="ORDER_ITEM_SLI" rel-entity-name="ShoppingListItem">
        <key-map field-name="shoppingListId"/>
        <key-map field-name="shoppingListItemSeqId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITEM_OGLA" title="Override" rel-entity-name="GlAccount">
        <key-map field-name="overrideGlAccountId" rel-field-name="glAccountId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITEM_SLSOPP" rel-entity-name="SalesOpportunity" >
            <key-map field-name="salesOpportunityId"/>
      </relation>
        <relation type="one" fk-name="ORDER_ITEM_USRLGN" title="ChangeBy" rel-entity-name="UserLogin">
            <key-map field-name="changeByUserLoginId" rel-field-name="userLoginId"/>
        </relation>      
      <index name="ORDITMEXT_ID_IDX">
        <index-field name="externalId"/>
      </index>
    </entity>
    <entity entity-name="OrderItemAssoc"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Item Assoc">
      <field name="orderId" type="id"></field>
      <field name="orderItemSeqId" type="id"></field>
      <field name="shipGroupSeqId" type="id"></field>
      <field name="toOrderId" type="id"></field>
      <field name="toOrderItemSeqId" type="id"></field>
      <field name="toShipGroupSeqId" type="id"></field>
      <field name="orderItemAssocTypeId" type="id"></field>
      <field name="quantity" type="fixed-point"></field>
      <prim-key field="orderId"/>
      <prim-key field="orderItemSeqId"/>
      <prim-key field="shipGroupSeqId"/>
      <prim-key field="toOrderId"/>
      <prim-key field="toOrderItemSeqId"/>
      <prim-key field="toShipGroupSeqId"/>
      <prim-key field="orderItemAssocTypeId"/>
      <relation type="one" fk-name="ORDER_ITASS_TYPE" rel-entity-name="OrderItemAssocType">
        <key-map field-name="orderItemAssocTypeId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITASS_FRHD" title="From" rel-entity-name="OrderHeader">
        <key-map field-name="orderId" rel-field-name="orderId"/>
      </relation>
      <relation type="one-nofk" title="From" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
      <relation type="one-nofk" title="From" rel-entity-name="OrderItemShipGroupAssoc">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
        <key-map field-name="shipGroupSeqId"/>
      </relation>
      <relation type="one-nofk" title="From" rel-entity-name="OrderItemShipGroup">
        <key-map field-name="orderId"/>
        <key-map field-name="shipGroupSeqId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITASS_TOHD" title="To" rel-entity-name="OrderHeader">
        <key-map field-name="toOrderId" rel-field-name="orderId"/>
      </relation>
      <relation type="one-nofk" title="To" rel-entity-name="OrderItem">
        <key-map field-name="toOrderId" rel-field-name="orderId"/>
        <key-map field-name="toOrderItemSeqId" rel-field-name="orderItemSeqId"/>
      </relation>
      <relation type="one-nofk" title="To" rel-entity-name="OrderItemShipGroupAssoc">
        <key-map field-name="toOrderId" rel-field-name="orderId"/>
        <key-map field-name="toOrderItemSeqId" rel-field-name="orderItemSeqId"/>
        <key-map field-name="toShipGroupSeqId" rel-field-name="shipGroupSeqId"/>
      </relation>
      <relation type="one-nofk" title="To" rel-entity-name="OrderItemShipGroup">
        <key-map field-name="toOrderId" rel-field-name="orderId"/>
        <key-map field-name="toShipGroupSeqId" rel-field-name="shipGroupSeqId"/>
      </relation>
    </entity>
    <entity entity-name="OrderItemAssocType"
            package-name="org.apache.ofbiz.order.order"
            title="Order Item Assoc Type">
      <field name="orderItemAssocTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="orderItemAssocTypeId"/>
      <relation type="one" fk-name="ORDER_ITAS_TYPPAR" title="Parent" rel-entity-name="OrderItemAssocType">
        <key-map field-name="parentTypeId" rel-field-name="orderItemAssocTypeId"/>
      </relation>
    </entity>

    <entity entity-name="OrderItemAttribute"
            package-name="org.apache.ofbiz.order.order"
            title="Order Item Attribute">
      <field name="orderId" type="id"></field>
      <field name="orderItemSeqId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="attrValue" type="value"></field>
      <field name="attrDescription" type="description"></field>
      <prim-key field="orderId"/>
      <prim-key field="orderItemSeqId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="ORDER_ITEM_ATTR" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItemTypeAttr">
        <key-map field-name="attrName"/>
      </relation>
    </entity>
    <entity entity-name="OrderItemBilling"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Item Billing">
      <field name="orderId" type="id"></field>
      <field name="orderItemSeqId" type="id"></field>
      <field name="invoiceId" type="id"></field>
      <field name="invoiceItemSeqId" type="id"></field>
      <field name="itemIssuanceId" type="id"></field>
      <field name="shipmentReceiptId" type="id"></field>
      <field name="quantity" type="fixed-point"></field>
      <field name="amount" type="currency-amount"></field>
      <prim-key field="orderId"/>
      <prim-key field="orderItemSeqId"/>
      <prim-key field="invoiceId"/>
      <prim-key field="invoiceItemSeqId"/>
      <relation type="one" fk-name="ORDER_ITBLNG_OHDR" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITBLNG_OITM" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
      <relation type="one-nofk" fk-name="ORDER_ITBLNG_INV" rel-entity-name="Invoice">
        <key-map field-name="invoiceId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITBLNG_IITM" rel-entity-name="InvoiceItem">
        <key-map field-name="invoiceId"/>
        <key-map field-name="invoiceItemSeqId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITBL_SHIPRCP" rel-entity-name="ShipmentReceipt">
        <key-map field-name="shipmentReceiptId" rel-field-name="receiptId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITBLNG_IISS" rel-entity-name="ItemIssuance">
        <key-map field-name="itemIssuanceId"/>
      </relation>
    </entity>
    <entity entity-name="OrderItemChange"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Item Change">
      <field name="orderItemChangeId" type="id"></field>
      <field name="orderId" type="id"></field>
      <field name="orderItemSeqId" type="id"></field>
      <field name="changeTypeEnumId" type="id"></field>
      <field name="changeDatetime" type="date-time"></field>
      <field name="changeUserLogin" type="id-vlong"></field>
      <field name="quantity" type="fixed-point"></field>
      <field name="cancelQuantity" type="fixed-point"></field>
      <field name="unitPrice" type="currency-amount"></field>
      <field name="itemDescription" type="description"></field>
      <field name="reasonEnumId" type="id"></field>
      <field name="changeComments" type="comment"></field>
      <prim-key field="orderItemChangeId"/>
      <relation type="one-nofk" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITCH_OITM" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITCH_TYPE" rel-entity-name="Enumeration">
        <key-map field-name="changeTypeEnumId" rel-field-name="enumId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITCH_REAS" title="Reason" rel-entity-name="Enumeration">
          <key-map field-name="reasonEnumId" rel-field-name="enumId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITCH_USER" rel-entity-name="UserLogin">
        <key-map field-name="changeUserLogin" rel-field-name="userLoginId"/>
      </relation>
    </entity>
    <entity entity-name="OrderItemContactMech"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Item Contact Mechanism">
      <field name="orderId" type="id"></field>
      <field name="orderItemSeqId" type="id"></field>
      <field name="contactMechPurposeTypeId" type="id"></field>
      <field name="contactMechId" type="id"></field>
      <prim-key field="orderId"/>
      <prim-key field="orderItemSeqId"/>
      <prim-key field="contactMechPurposeTypeId"/>
      <relation type="one-nofk" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITCM_OITM" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITCM_CMECH" rel-entity-name="ContactMech">
        <key-map field-name="contactMechId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITCM_CMPT" rel-entity-name="ContactMechPurposeType">
        <key-map field-name="contactMechPurposeTypeId"/>
      </relation>
    </entity>
    <entity entity-name="OrderItemGroup" package-name="org.apache.ofbiz.order.order" title="Order Item Group">
        <field name="orderId" type="id"></field>
        <field name="orderItemGroupSeqId" type="id"></field>
        <field name="parentGroupSeqId" type="id"></field>
        <field name="groupName" type="name"></field>
        <prim-key field="orderId"/>
        <prim-key field="orderItemGroupSeqId"/>
        <relation type="one" fk-name="ORDERITMGRP_HDR" rel-entity-name="OrderHeader">
            <key-map field-name="orderId"/>
        </relation>
        <relation type="one" fk-name="ORDERITMGRP_PGRP" title="Parent" rel-entity-name="OrderItemGroup">
            <key-map field-name="orderId"/>
            <key-map field-name="parentGroupSeqId" rel-field-name="orderItemGroupSeqId"/>
        </relation>
    </entity>
    <entity entity-name="OrderItemGroupOrder"
            package-name="org.apache.ofbiz.order.order"
            title="Order Item Group Order">
      <field name="orderId" type="id"></field>
      <field name="orderItemSeqId" type="id"></field>
      <field name="groupOrderId" type="id"></field>
      <prim-key field="orderId"/>
      <prim-key field="orderItemSeqId"/>
      <prim-key field="groupOrderId"/>
      <relation type="one" fk-name="OIGO_ORDER_ITEM" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
      <relation type="one" fk-name="OIGO_GROUP_ORDER" rel-entity-name="ProductGroupOrder">
        <key-map field-name="groupOrderId"/>
      </relation>
    </entity>
    <entity entity-name="OrderItemPriceInfo"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Item Price Info">
      <field name="orderItemPriceInfoId" type="id"></field>
      <field name="orderId" type="id"></field>
      <field name="orderItemSeqId" type="id"></field>
      <field name="productPriceRuleId" type="id"></field>
      <field name="productPriceActionSeqId" type="id"></field>
      <field name="modifyAmount" type="currency-precise"></field>
      <field name="description" type="description"></field>
      <field name="rateCode" type="short-varchar"></field>
      <prim-key field="orderItemPriceInfoId"/>
      <relation type="one-nofk" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one" fk-name="ORDER_OIPI_OITM" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="ProductPriceRule">
        <key-map field-name="productPriceRuleId"/>
      </relation>
      <relation type="one" fk-name="ORDER_OIPI_PRAI" rel-entity-name="ProductPriceAction">
        <key-map field-name="productPriceRuleId"/>
        <key-map field-name="productPriceActionSeqId"/>
      </relation>
    </entity>
    <entity entity-name="OrderItemRole"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Item Role">
      <field name="orderId" type="id"></field>
      <field name="orderItemSeqId" type="id"></field>
      <field name="partyId" type="id"></field>
      <field name="roleTypeId" type="id"></field>
      <prim-key field="orderId"/>
      <prim-key field="orderItemSeqId"/>
      <prim-key field="partyId"/>
      <prim-key field="roleTypeId"/>
      <relation type="one" fk-name="ORDER_ITRL_OHDR" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITRL_OITM" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITRL_PARTY" rel-entity-name="Party">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="RoleType">
        <key-map field-name="roleTypeId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITRL_PTRLE" rel-entity-name="PartyRole">
        <key-map field-name="partyId"/>
        <key-map field-name="roleTypeId"/>
      </relation>
    </entity>
    <entity entity-name="OrderItemShipGroup"
            package-name="org.apache.ofbiz.order.order"
            title="Order Item Ship Group">
      <field name="orderId" type="id"></field>
      <field name="shipGroupSeqId" type="id"></field>
      <field name="shipmentMethodTypeId" type="id" enable-audit-log="true"></field>
      <field name="supplierPartyId" type="id"></field>
      <field name="supplierAgreementId" type="id"/>
      <field name="vendorPartyId" type="id"><description>For use with multi-vendor stores, order will be split so that each ship group is associated with only one vendor (only if applicable)</description></field>
      <field name="carrierPartyId" type="id" enable-audit-log="true"></field>
      <field name="carrierRoleTypeId" type="id"></field>
      <field name="facilityId" type="id"></field>
      <field name="contactMechId" type="id"></field>
      <field name="telecomContactMechId" type="id"></field>
      <field name="trackingNumber" type="short-varchar"></field>
      <field name="shippingInstructions" type="long-varchar"></field>
      <field name="maySplit" type="indicator"></field>
      <field name="giftMessage" type="long-varchar"></field>
      <field name="isGift" type="indicator"></field>
      <field name="shipAfterDate" type="date-time"></field>
      <field name="shipByDate" type="date-time"></field>
      <field name="estimatedShipDate" type="date-time"></field>
      <field name="estimatedDeliveryDate" type="date-time"></field>
      <prim-key field="orderId"/>
      <prim-key field="shipGroupSeqId"/>
      <relation type="one" fk-name="ORDER_ITSG_ORDH" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITSG_SPRTY" title="Supplier" rel-entity-name="Party">
        <key-map field-name="supplierPartyId" rel-field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITSG_SAGR" title="Supplier" rel-entity-name="Agreement">
        <key-map field-name="supplierAgreementId" rel-field-name="agreementId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITSG_VPRTY" title="Vendor" rel-entity-name="Party">
        <key-map field-name="vendorPartyId" rel-field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITSG_CSHM" rel-entity-name="CarrierShipmentMethod">
        <key-map field-name="shipmentMethodTypeId"/>
        <key-map field-name="carrierPartyId" rel-field-name="partyId"/>
        <key-map field-name="carrierRoleTypeId" rel-field-name="roleTypeId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITSG_CPRTY" title="Carrier" rel-entity-name="Party">
        <key-map field-name="carrierPartyId" rel-field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITSG_CPRLE" title="Carrier" rel-entity-name="PartyRole">
        <key-map field-name="carrierPartyId" rel-field-name="partyId"/>
        <key-map field-name="carrierRoleTypeId" rel-field-name="roleTypeId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITSG_FAC" rel-entity-name="Facility">
        <key-map field-name="facilityId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITSG_SHMTP" rel-entity-name="ShipmentMethodType">
        <key-map field-name="shipmentMethodTypeId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITSG_CNTM" rel-entity-name="ContactMech">
        <key-map field-name="contactMechId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITSG_PADR" rel-entity-name="PostalAddress">
        <key-map field-name="contactMechId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITSG_TCNT" title="Telecom" rel-entity-name="ContactMech">
        <key-map field-name="telecomContactMechId" rel-field-name="contactMechId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITSG_TCNB" title="Telecom" rel-entity-name="TelecomNumber">
        <key-map field-name="telecomContactMechId" rel-field-name="contactMechId"/>
      </relation>
    </entity>
    <entity entity-name="OrderItemShipGroupAssoc"
            package-name="org.apache.ofbiz.order.order"
            title="Order Item Package Association">
      <field name="orderId" type="id"></field>
      <field name="orderItemSeqId" type="id"></field>
      <field name="shipGroupSeqId" type="id"></field>
      <field name="quantity" type="fixed-point"></field>
      <field name="cancelQuantity" type="fixed-point"></field>
      <prim-key field="orderId"/>
      <prim-key field="orderItemSeqId"/>
      <prim-key field="shipGroupSeqId"/>
      <relation type="one" fk-name="ORDER_ISGA_ORDH" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ISGA_ORDI" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ISGA_OISG" rel-entity-name="OrderItemShipGroup">
        <key-map field-name="orderId"/>
        <key-map field-name="shipGroupSeqId"/>
      </relation>
    </entity>
    <entity entity-name="OrderItemShipGrpInvRes"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Item Inventory Reservation">
      <field name="orderId" type="id"></field>
      <field name="shipGroupSeqId" type="id"></field>
      <field name="orderItemSeqId" type="id"></field>
      <field name="inventoryItemId" type="id"></field>
      <field name="reserveOrderEnumId" type="id"></field>
      <field name="quantity" type="fixed-point"></field>
      <field name="quantityNotAvailable" type="fixed-point"></field>
      <field name="reservedDatetime" type="date-time"></field>
      <field name="createdDatetime" type="date-time"></field>
      <field name="promisedDatetime" type="date-time"></field>
      <field name="currentPromisedDate" type="date-time"></field>
      <field name="priority" type="indicator"><description>Sets priority for Inventory Reservation</description></field>
      <field name="sequenceId" type="numeric"></field>
      <field name="oldPickStartDate" col-name="PICK_START_DATE" type="date-time"></field> <!-- this is no longer used and is here for migration or whatever if needed -->
      <prim-key field="orderId"/>
      <prim-key field="shipGroupSeqId"/>
      <prim-key field="orderItemSeqId"/>
      <prim-key field="inventoryItemId"/>
      <relation type="one-nofk" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITIR_OITM" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="OrderItemShipGroup">
        <key-map field-name="orderId"/>
        <key-map field-name="shipGroupSeqId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="OrderItemShipGroupAssoc">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
        <key-map field-name="shipGroupSeqId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ITIR_INVITM" rel-entity-name="InventoryItem">
        <key-map field-name="inventoryItemId"/>
      </relation>
    </entity>
    <entity entity-name="OrderItemType"
            package-name="org.apache.ofbiz.order.order"
            default-resource-name="OrderEntityLabels"
            title="Order Item Type">
      <field name="orderItemTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="orderItemTypeId"/>
      <relation type="one" fk-name="ORDER_ITEM_TYPPAR" title="Parent" rel-entity-name="OrderItemType">
        <key-map field-name="parentTypeId" rel-field-name="orderItemTypeId"/>
      </relation>
    </entity>
    <entity entity-name="OrderItemTypeAttr"
            package-name="org.apache.ofbiz.order.order"
            title="Order Item Type Attribute">
      <field name="orderItemTypeId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="description" type="description"></field>
      <prim-key field="orderItemTypeId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="ORDER_ITEM_TYPATR" rel-entity-name="OrderItemType">
        <key-map field-name="orderItemTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItemAttribute">
        <key-map field-name="attrName"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItem">
        <key-map field-name="orderItemTypeId"/>
      </relation>
    </entity>
    <entity entity-name="OrderNotification"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Notification">
      <field name="orderNotificationId" type="id"></field>
      <field name="orderId" type="id"></field>
      <field name="emailType" type="id"></field>
      <field name="comments" type="comment"></field>
      <field name="notificationDate" type="date-time"></field>
      <prim-key field="orderNotificationId"/>
      <relation type="one" fk-name="ORD_NOTIFY_ORDHDR" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one" fk-name="ORD_NOTIFY_ENUM" rel-entity-name="Enumeration">
        <key-map field-name="emailType" rel-field-name="enumId"/>
      </relation>
    </entity>
    <entity entity-name="OrderPaymentPreference"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="The Order Payment Preference">
      <field name="orderPaymentPreferenceId" type="id"></field>
      <field name="orderId" type="id"></field>
      <field name="orderItemSeqId" type="id"></field>
      <field name="shipGroupSeqId" type="id"></field>
      <field name="productPricePurposeId" type="id"></field>
      <field name="paymentMethodTypeId" type="id"></field>
      <field name="paymentMethodId" type="id"></field>
      <field name="finAccountId" type="id"><description>For paying with a fin account instead of payment method on file</description></field>
      <field name="securityCode" type="long-varchar" encrypt="true">
          <description>NOTE: THIS SHOULD NEVER BE PERSISTED OUTSIDE THE SCOPE OF A SINGLE TRANSACTION,
              TYPICALLY ONLY FOR AUTHORIZATION PURPOSES, SHOULD BE REMOVED IMMEDIATELY FOLLOWING USE;
              this is the 3 digit on back (for Visa, MC, etc) or 4 digit on front (Amex, etc) card
              verification code; also note that this field is longer than needed to accommodate encryption.
          </description>
      </field>
      <field name="track2" type="long-varchar" encrypt="true">
          <description>NOTE: THIS SHOULD NEVER BE PERSISTED OUTSIDE THE SCOPE OF A SINGLE TRANSACTION,
              TYPICALLY ONLY FOR AUTHORIZATION PURPOSES, SHOULD BE REMOVED IMMEDIATELY FOLLOWING USE;
              this is raw track2 data, exactly as read by the magnetic swipe reader;
              also note that this field is longer than needed to accommodate encryption.
          </description>
      </field>
      <field name="presentFlag" type="indicator"></field>
      <field name="swipedFlag" type="indicator"></field>
      <field name="overflowFlag" type="indicator"></field>
      <field name="maxAmount" type="currency-amount"></field>
      <field name="processAttempt" type="numeric"></field>
      <field name="billingPostalCode" type="short-varchar"></field>
      <field name="manualAuthCode" type="short-varchar"></field>
      <field name="manualRefNum" type="short-varchar"></field>
      <field name="statusId" type="id"></field>
      <field name="needsNsfRetry" type="indicator"></field>
      <field name="createdDate" type="date-time"></field>
      <field name="createdByUserLogin" type="id-vlong"></field>
      <field name="lastModifiedDate" type="date-time"></field>
      <field name="lastModifiedByUserLogin" type="id-vlong"></field>
      <prim-key field="orderPaymentPreferenceId"/>
      <relation type="one" fk-name="ORDER_PMPRF_OHDR" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="OrderItemShipGroup">
        <key-map field-name="orderId"/>
        <key-map field-name="shipGroupSeqId"/>
      </relation>
      <relation type="one" fk-name="ORDER_PMPRF_PPRP" rel-entity-name="ProductPricePurpose">
        <key-map field-name="productPricePurposeId"/>
      </relation>
      <relation type="one" fk-name="ORDER_PMPRF_PMTP" rel-entity-name="PaymentMethodType">
        <key-map field-name="paymentMethodTypeId"/>
      </relation>
      <relation type="one" fk-name="ORDER_PMPRF_PMETH" rel-entity-name="PaymentMethod">
        <key-map field-name="paymentMethodId"/>
      </relation>
      <relation type="one" fk-name="ORDER_PMPRF_FINACT" rel-entity-name="FinAccount">
        <key-map field-name="finAccountId"/>
      </relation>
      <relation type="one" fk-name="ORDER_PMPRF_STTS" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
      <relation type="one" fk-name="ORDER_PMPRF_USRL" rel-entity-name="UserLogin">
        <key-map field-name="createdByUserLogin" rel-field-name="userLoginId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="CreditCard">
        <key-map field-name="paymentMethodId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="EftAccount">
        <key-map field-name="paymentMethodId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="GiftCard">
        <key-map field-name="paymentMethodId"/>
      </relation>
      <index name="NSF_RETRY_CHECK">
        <index-field name="needsNsfRetry"/>
      </index>
    </entity>
    <entity entity-name="OrderProductPromoCode" package-name="org.apache.ofbiz.order.order" title="Order Product Promo Code">
        <field name="orderId" type="id"></field>
        <field name="productPromoCodeId" type="id"></field>
        <prim-key field="orderId"/>
        <prim-key field="productPromoCodeId"/>
        <relation type="one" fk-name="ORDER_PPCD_ORD" rel-entity-name="OrderHeader">
            <key-map field-name="orderId"/>
        </relation>
        <relation type="one" fk-name="ORDER_PPCD_PPC" rel-entity-name="ProductPromoCode">
            <key-map field-name="productPromoCodeId"/>
        </relation>
    </entity>
    <entity entity-name="OrderRole"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Role">
      <field name="orderId" type="id"></field>
      <field name="partyId" type="id"></field>
      <field name="roleTypeId" type="id"></field>
      <prim-key field="orderId"/>
      <prim-key field="partyId"/>
      <prim-key field="roleTypeId"/>
      <relation type="one" fk-name="ORDER_ROLE_OHDR" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ROLE_PARTY" rel-entity-name="Party">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="ORDER_ROLE_PROLE" 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>
      <relation type="many" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
      </relation>
    </entity>
    <entity entity-name="OrderShipment"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Shipment">
      <field name="orderId" type="id"></field>
      <field name="orderItemSeqId" type="id"></field>
      <field name="shipGroupSeqId" type="id"></field>
      <field name="shipmentId" type="id"></field>
      <field name="shipmentItemSeqId" type="id"></field>
      <field name="quantity" type="fixed-point"></field>
      <prim-key field="orderId"/>
      <prim-key field="orderItemSeqId"/>
      <prim-key field="shipGroupSeqId"/>
      <prim-key field="shipmentId"/>
      <prim-key field="shipmentItemSeqId"/>
      <relation type="one" fk-name="ORDER_SHPMT_OHDR" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
      <relation type="one" fk-name="ORDER_SHPMT_SHPMT" rel-entity-name="Shipment">
        <key-map field-name="shipmentId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="ShipmentItem">
        <key-map field-name="shipmentId"/>
        <key-map field-name="shipmentItemSeqId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="OrderItemShipGroupAssoc">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
        <key-map field-name="shipGroupSeqId"/>
      </relation>
    </entity>
    <entity entity-name="OrderStatus"
            package-name="org.apache.ofbiz.order.order"
            never-cache="true"
            title="Order Status">
      <field name="orderStatusId" type="id"></field>
      <field name="statusId" type="id"></field>
      <field name="orderId" type="id"></field>
      <field name="orderItemSeqId" type="id"></field>
      <field name="orderPaymentPreferenceId" type="id"></field>
      <field name="statusDatetime" type="date-time"></field>
      <field name="statusUserLogin" type="id-vlong"></field>
      <field name="changeReason" type="description"></field>
      <prim-key field="orderStatusId"/>
      <relation type="one" fk-name="ORDER_STTS_STTS" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
      <relation type="one" fk-name="ORDER_STTS_OHDR" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="OrderPaymentPreference">
        <key-map field-name="orderPaymentPreferenceId"/>
      </relation>
      <relation type="one" fk-name="ORDER_STTS_USER" rel-entity-name="UserLogin">
        <key-map field-name="statusUserLogin" rel-field-name="userLoginId"/>
      </relation>
    </entity>
    <entity entity-name="OrderSummaryEntry"
            package-name="org.apache.ofbiz.order.order"
            title="Order Summary Entry">
      <field name="entryDate" type="date"></field>
      <field name="productId" type="id"></field>
      <field name="facilityId" type="id"></field>
      <field name="totalQuantity" type="fixed-point"></field>
      <field name="grossSales" type="currency-amount"></field>
      <field name="productCost" type="currency-amount"></field>
      <prim-key field="entryDate"/>
      <prim-key field="productId"/>
      <prim-key field="facilityId"/>
      <relation type="one" fk-name="ORDER_SMENT_PROD" rel-entity-name="Product">
        <key-map field-name="productId"/>
      </relation>
      <relation type="one" fk-name="ORDER_SMENT_FAC" rel-entity-name="Facility">
        <key-map field-name="facilityId"/>
      </relation>
    </entity>
    <entity entity-name="OrderTerm"
            package-name="org.apache.ofbiz.order.order"
            title="Order Term">
      <field name="termTypeId" type="id"></field>
      <field name="orderId" type="id"></field>
      <field name="orderItemSeqId" type="id"></field>
      <field name="termValue" type="currency-amount"></field>
      <field name="termDays" type="numeric"></field>
      <field name="textValue" type="description"></field>
      <field name="description" type="description"></field>
      <field name="uomId" type="id"></field>
      <prim-key field="termTypeId"/>
      <prim-key field="orderId"/>
      <prim-key field="orderItemSeqId"/>
      <relation type="one" fk-name="ORDER_TERM_UOM" rel-entity-name="Uom">
        <key-map field-name="uomId"/>
      </relation>
      <relation type="one" fk-name="ORDER_TERM_OHDR" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
      <relation type="one" fk-name="ORDER_TERM_TTYPE" rel-entity-name="TermType">
        <key-map field-name="termTypeId"/>
      </relation>
    </entity>
    <entity entity-name="OrderTermAttribute"
            package-name="org.apache.ofbiz.order.order"
            title="Order Term Attribute">
      <field name="termTypeId" type="id"></field>
      <field name="orderId" type="id"></field>
      <field name="orderItemSeqId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="attrValue" type="value"></field>
      <field name="attrDescription" type="description"></field>
      <prim-key field="termTypeId"/>
      <prim-key field="orderId"/>
      <prim-key field="orderItemSeqId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="ORDER_TATTR_OTRM" rel-entity-name="OrderTerm">
        <key-map field-name="termTypeId"/>
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
    </entity>
    <entity entity-name="OrderType"
            package-name="org.apache.ofbiz.order.order"
            default-resource-name="OrderEntityLabels"
            title="Order Type">
      <field name="orderTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="orderTypeId"/>
      <relation type="one" fk-name="ORDER_TYPE_PARENT" title="Parent" rel-entity-name="OrderType">
        <key-map field-name="parentTypeId" rel-field-name="orderTypeId"/>
      </relation>
    </entity>
    <entity entity-name="OrderTypeAttr"
            package-name="org.apache.ofbiz.order.order"
            title="Order Type Attribute">
      <field name="orderTypeId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="description" type="description"></field>
      <prim-key field="orderTypeId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="ORDER_TPAT_ORTYP" rel-entity-name="OrderType">
        <key-map field-name="orderTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="OrderAttribute">
        <key-map field-name="attrName"/>
      </relation>
      <relation type="many" rel-entity-name="OrderHeader">
        <key-map field-name="orderTypeId"/>
      </relation>
    </entity>
    <entity entity-name="ProductOrderItem"
            package-name="org.apache.ofbiz.order.order"
            title="Product Order Item">
      <field name="orderId" type="id"></field>
      <field name="orderItemSeqId" type="id"></field>
      <field name="engagementId" type="id"></field>
      <field name="engagementItemSeqId" type="id"></field>
      <field name="productId" type="id"></field>
      <prim-key field="orderId"/>
      <prim-key field="orderItemSeqId"/>
      <prim-key field="engagementId"/>
      <prim-key field="engagementItemSeqId"/>
      <relation type="one" fk-name="PROD_OITEM_OHDR" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one" fk-name="PROD_OITEM_OITEM" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
      <relation type="one" fk-name="PROD_OITEM_PROD" rel-entity-name="Product">
        <key-map field-name="productId"/>
      </relation>
      <relation type="one" fk-name="PROD_OITEM_ENOHDR" title="Engagement" rel-entity-name="OrderHeader">
        <key-map field-name="engagementId" rel-field-name="orderId"/>
      </relation>
      <relation type="one" fk-name="PROD_OITEM_ENOITM" title="Engagement" rel-entity-name="OrderItem">
        <key-map field-name="engagementId" rel-field-name="orderId"/>
        <key-map field-name="engagementItemSeqId" rel-field-name="orderItemSeqId"/>
      </relation>
    </entity>
    <entity entity-name="WorkOrderItemFulfillment"
            package-name="org.apache.ofbiz.order.order"
            title="Work Order Item Fulfillment">
      <field name="workEffortId" type="id"></field>
      <field name="orderId" type="id"></field>
      <field name="orderItemSeqId" type="id"></field>
      <field name="shipGroupSeqId" type="id"></field>
      <prim-key field="workEffortId"/>
      <prim-key field="orderId"/>
      <prim-key field="orderItemSeqId"/>
      <relation type="one" fk-name="WORDER_ITFMT_OHDR" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one" fk-name="WORDER_ITFMT_OITM" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
      <relation type="one" fk-name="WORDER_ITFMT_WEFRT" rel-entity-name="WorkEffort">
        <key-map field-name="workEffortId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="OrderItemShipGroupAssoc">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
        <key-map field-name="shipGroupSeqId"/>
      </relation>
    </entity>

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

    <entity entity-name="Quote"
            package-name="org.apache.ofbiz.order.quote"
            title="Quote">
      <field name="quoteId" type="id"></field>
      <field name="quoteTypeId" type="id"></field>
      <field name="partyId" type="id"></field>
      <field name="issueDate" type="date-time"></field>
      <field name="statusId" type="id"></field>
      <field name="currencyUomId" type="id"></field>
      <field name="productStoreId" type="id"></field>
      <field name="salesChannelEnumId" type="id"></field>
      <field name="validFromDate" type="date-time"></field>
      <field name="validThruDate" type="date-time"></field>
      <field name="quoteName" type="name"></field>
      <field name="description" type="description"></field>
      <prim-key field="quoteId"/>
      <relation type="one" fk-name="QUOTE_QTTYP" rel-entity-name="QuoteType">
        <key-map field-name="quoteTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="QuoteTypeAttr">
        <key-map field-name="quoteTypeId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_PRTY" rel-entity-name="Party">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_STATUS" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_CUOM" rel-entity-name="Uom">
        <key-map field-name="currencyUomId" rel-field-name="uomId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_PRDS" rel-entity-name="ProductStore">
        <key-map field-name="productStoreId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_CHANNEL" title="SalesChannel" rel-entity-name="Enumeration">
        <key-map field-name="salesChannelEnumId" rel-field-name="enumId"/>
      </relation>
      <relation type="many" rel-entity-name="QuoteNoteView">
        <key-map field-name="quoteId"/>
      </relation>
    </entity>
    <entity entity-name="QuoteAttribute"
            package-name="org.apache.ofbiz.order.quote"
            title="Quote Attribute">
      <field name="quoteId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="attrValue" type="value"></field>
      <field name="attrDescription" type="description"></field>
      <prim-key field="quoteId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="QUOTE_ATTR" rel-entity-name="Quote">
        <key-map field-name="quoteId"/>
      </relation>
      <relation type="many" rel-entity-name="QuoteTypeAttr">
        <key-map field-name="attrName"/>
      </relation>
    </entity>
    <entity entity-name="QuoteCoefficient"
        package-name="org.apache.ofbiz.order.quote"
        title="Quote Coefficient">
        <field name="quoteId" type="id"></field>
        <field name="coeffName" type="id-long"></field>
        <field name="coeffValue" type="fixed-point"></field>
        <prim-key field="quoteId"/>
        <prim-key field="coeffName"/>
        <relation type="one" fk-name="QUOTE_COEFF" rel-entity-name="Quote">
            <key-map field-name="quoteId"/>
        </relation>
    </entity>
    <entity entity-name="QuoteItem"
            package-name="org.apache.ofbiz.order.quote"
            title="Quote Item">
      <field name="quoteId" type="id"></field>
      <field name="quoteItemSeqId" type="id"></field>
      <field name="productId" type="id"></field>
      <field name="productFeatureId" type="id"></field>
      <field name="deliverableTypeId" type="id"></field>
      <field name="skillTypeId" type="id"></field>
      <field name="uomId" type="id"></field>
      <field name="workEffortId" type="id"></field>
      <field name="custRequestId" type="id"></field>
      <field name="custRequestItemSeqId" type="id"></field>
      <field name="quantity" type="fixed-point"></field>
      <field name="selectedAmount" type="fixed-point"></field>
      <field name="quoteUnitPrice" type="currency-amount"></field>
      <field name="reservStart" type="date-time"></field>
      <field name="reservLength" type="fixed-point"></field>
      <field name="reservPersons" type="fixed-point"></field>
      <field name="configId" type="id"></field>
      <field name="estimatedDeliveryDate" type="date-time"></field>
      <field name="comments" type="comment"></field>
      <field name="isPromo" type="indicator"></field>
      <field name="leadTimeDays" type="numeric"></field>
      <prim-key field="quoteId"/>
      <prim-key field="quoteItemSeqId"/>
      <relation type="one" fk-name="QUOTE_ITM_QTE" rel-entity-name="Quote">
        <key-map field-name="quoteId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_ITM_PROD" rel-entity-name="Product">
        <key-map field-name="productId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_ITM_PFEAT" rel-entity-name="ProductFeature">
        <key-map field-name="productFeatureId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_ITM_DELT" rel-entity-name="DeliverableType">
        <key-map field-name="deliverableTypeId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_ITM_SKLT" rel-entity-name="SkillType">
        <key-map field-name="skillTypeId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_ITM_UOM" rel-entity-name="Uom">
        <key-map field-name="uomId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_ITM_WKEFF" rel-entity-name="WorkEffort">
        <key-map field-name="workEffortId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_ITM_CSRQ" rel-entity-name="CustRequest">
        <key-map field-name="custRequestId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_ITM_CSRITM" rel-entity-name="CustRequestItem">
        <key-map field-name="custRequestId"/>
        <key-map field-name="custRequestItemSeqId"/>
      </relation>
    </entity>
    <entity entity-name="QuoteNote"
            package-name="org.apache.ofbiz.order.quote"
            never-cache="true"
            title="Quote Note">
      <field name="quoteId" type="id"></field>
      <field name="noteId" type="id"></field>
      <prim-key field="quoteId"/>
      <prim-key field="noteId"/>
      <relation type="one" fk-name="QUOTE_NT_QTE" rel-entity-name="Quote">
        <key-map field-name="quoteId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_NT_NOTE" rel-entity-name="NoteData">
        <key-map field-name="noteId"/>
      </relation>
    </entity>
    <entity entity-name="QuoteRole"
            package-name="org.apache.ofbiz.order.quote"
            title="Quote Role">
      <field name="quoteId" type="id"/>
      <field name="partyId" type="id"/>
      <field name="roleTypeId" type="id"/>
      <field name="fromDate" type="date-time"/>
      <field name="thruDate" type="date-time"/>
      <prim-key field="quoteId"/>
      <prim-key field="partyId"/>
      <prim-key field="roleTypeId"/>
      <relation type="one" fk-name="QUOTE_RL_QUOTE" rel-entity-name="Quote">
        <key-map field-name="quoteId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_RL_PARTY" rel-entity-name="Party">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="RoleType">
        <key-map field-name="roleTypeId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_RL_PROLE" rel-entity-name="PartyRole">
        <key-map field-name="partyId"/>
        <key-map field-name="roleTypeId"/>
      </relation>
    </entity>
    <entity entity-name="QuoteTerm"
            package-name="org.apache.ofbiz.order.quote"
            title="Quote Term">
      <field name="termTypeId" type="id"></field>
      <field name="quoteId" type="id"></field>
      <field name="quoteItemSeqId" type="id"></field>
      <field name="termValue" type="numeric"></field>
      <field name="uomId" type="id"></field>
      <field name="termDays" type="numeric"></field>
      <field name="textValue" type="description"></field>
      <field name="description" type="description"></field>
      <prim-key field="termTypeId"/>
      <prim-key field="quoteId"/>
      <prim-key field="quoteItemSeqId"/>
      <relation type="one" fk-name="QUOTE_TERM_QTE" rel-entity-name="Quote">
        <key-map field-name="quoteId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="QuoteItem">
        <key-map field-name="quoteId"/>
        <key-map field-name="quoteItemSeqId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_TERM_TTYPE" rel-entity-name="TermType">
        <key-map field-name="termTypeId"/>
      </relation>
    </entity>
    <entity entity-name="QuoteTermAttribute"
            package-name="org.apache.ofbiz.order.quote"
            title="Quote Term Attribute">
      <field name="termTypeId" type="id"></field>
      <field name="quoteId" type="id"></field>
      <field name="quoteItemSeqId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="attrValue" type="value"></field>
      <field name="attrDescription" type="description"></field>
      <prim-key field="termTypeId"/>
      <prim-key field="quoteId"/>
      <prim-key field="quoteItemSeqId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="QUOTE_TERM_ATTR" rel-entity-name="QuoteTerm">
        <key-map field-name="termTypeId"/>
        <key-map field-name="quoteId"/>
        <key-map field-name="quoteItemSeqId"/>
      </relation>
    </entity>
    <entity entity-name="QuoteType"
            package-name="org.apache.ofbiz.order.quote"
            default-resource-name="OrderEntityLabels"
            title="Quote Type">
      <field name="quoteTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="quoteTypeId"/>
      <relation type="one" fk-name="QUOTE_TYPE_PAR" title="Parent" rel-entity-name="QuoteType">
        <key-map field-name="parentTypeId" rel-field-name="quoteTypeId"/>
      </relation>
    </entity>
    <entity entity-name="QuoteTypeAttr"
            package-name="org.apache.ofbiz.order.quote"
            title="Quote Type Attribute">
      <field name="quoteTypeId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="description" type="description"></field>
      <prim-key field="quoteTypeId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="QUOTE_TPAT_QTYP" rel-entity-name="QuoteType">
        <key-map field-name="quoteTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="QuoteAttribute">
        <key-map field-name="attrName"/>
      </relation>
      <relation type="many" rel-entity-name="Quote">
        <key-map field-name="quoteTypeId"/>
      </relation>
    </entity>
    <entity entity-name="QuoteWorkEffort"
        package-name="org.apache.ofbiz.order.quote"
        title="Quote Work Effort">
        <field name="quoteId" type="id"></field>
        <field name="workEffortId" type="id"></field>
        <prim-key field="quoteId"/>
        <prim-key field="workEffortId"/>
        <relation type="one" fk-name="QUOTE_WE_QUOTE" rel-entity-name="Quote">
            <key-map field-name="quoteId"/>
        </relation>
        <relation type="one" fk-name="QUOTE_WE_WEFF" rel-entity-name="WorkEffort">
            <key-map field-name="workEffortId"/>
        </relation>
    </entity>
    <entity entity-name="QuoteAdjustment"
            package-name="org.apache.ofbiz.order.quote"
            never-cache="true"
            title="Quote Adjustment">
      <description>Note that both includeInTax and includeInShipping should default to true, except in the case where this adjustment is a tax or shipping adjustment then should be ignored.</description>
      <field name="quoteAdjustmentId" type="id"></field>
      <field name="quoteAdjustmentTypeId" type="id"></field>
      <field name="quoteId" type="id"></field>
      <field name="quoteItemSeqId" type="id"></field>
      <field name="comments" type="comment"></field>
      <field name="description" type="description"></field>
      <field name="amount" type="currency-amount"></field>
      <field name="productPromoId" type="id"></field>
      <field name="productPromoRuleId" type="id"></field>
      <field name="productPromoActionSeqId" type="id"></field>
      <field name="productFeatureId" type="id"></field>
      <field name="correspondingProductId" type="id"></field>
      <field name="sourceReferenceId" type="id-long"></field>
      <field name="sourcePercentage" type="fixed-point"><!-- for tax entries this is the tax percentage --></field>
      <field name="customerReferenceId" type="id-long"><!-- for tax entries this is partyTaxId --></field>
      <field name="primaryGeoId" type="id"><!-- for tax entries this is the primary jurisdiction Geo (the smallest or most local Geo that this tax is for, usually a state/province, perhaps a county or a city) --></field>
      <field name="secondaryGeoId" type="id"><!-- for tax entries this is the secondary jurisdiction Geo (usually a country, or other Geo that the primary is within) --></field>
      <field name="exemptAmount" type="currency-amount"><!-- an amount that would normally apply, but not to this order; for tax exemption represents the what the tax would have been --></field>
      <field name="taxAuthGeoId" type="id"></field><!-- these taxAuth fields deprecate the primaryGeoId and secondaryGeoId fields and will be used with the newer tax calc stuff -->
      <field name="taxAuthPartyId" type="id"></field>
      <field name="overrideGlAccountId" type="id"><!-- used to specify the override or actual glAccountId used for the adjustment, avoids problems if configuration changes after initial posting, etc --></field>
      <field name="includeInTax" type="indicator"></field>
      <field name="includeInShipping" type="indicator"></field>
      <field name="createdDate" type="date-time"></field>
      <field name="createdByUserLogin" type="id-vlong"></field>
      <field name="lastModifiedDate" type="date-time"></field>
      <field name="lastModifiedByUserLogin" type="id-vlong"></field>
      <prim-key field="quoteAdjustmentId"/>
      <relation type="one" fk-name="QUOTE_ADJ_TYPE" rel-entity-name="OrderAdjustmentType">
        <key-map field-name="quoteAdjustmentTypeId" rel-field-name="orderAdjustmentTypeId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_ADJ_OHEAD" rel-entity-name="Quote">
        <key-map field-name="quoteId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_ADJ_USERL" rel-entity-name="UserLogin">
        <key-map field-name="createdByUserLogin" rel-field-name="userLoginId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="QuoteItem">
        <key-map field-name="quoteId"/>
        <key-map field-name="quoteItemSeqId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_ADJ_PROMO" rel-entity-name="ProductPromo">
        <key-map field-name="productPromoId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="ProductPromoRule">
        <key-map field-name="productPromoId"/>
        <key-map field-name="productPromoRuleId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="ProductPromoAction">
        <key-map field-name="productPromoId"/>
        <key-map field-name="productPromoRuleId"/>
        <key-map field-name="productPromoActionSeqId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_ADJ_PRGEO" title="Primary" rel-entity-name="Geo">
        <key-map field-name="primaryGeoId" rel-field-name="geoId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_ADJ_SCGEO" title="Secondary" rel-entity-name="Geo">
        <key-map field-name="secondaryGeoId" rel-field-name="geoId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_ADJ_TXA" rel-entity-name="TaxAuthority">
        <key-map field-name="taxAuthGeoId"/>
        <key-map field-name="taxAuthPartyId"/>
      </relation>
      <relation type="one" fk-name="QUOTE_ADJ_OGLA" title="Override" rel-entity-name="GlAccount">
        <key-map field-name="overrideGlAccountId" rel-field-name="glAccountId"/>
      </relation>
    </entity>

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

    <entity entity-name="CustRequest"
            package-name="org.apache.ofbiz.order.request"
            title="Customer Request">
      <field name="custRequestId" type="id"></field>
      <field name="custRequestTypeId" type="id"></field>
      <field name="custRequestCategoryId" type="id"></field>
      <field name="statusId" type="id"></field>
      <field name="fromPartyId" type="id"></field>
      <field name="priority" type="numeric"></field>
      <field name="custRequestDate" type="date-time">
        <description>
          When the customer (or whoever) submitted the request, maybe out of OFBiz : comming by mail, email, etc.
        </description>
      </field>
      <field name="responseRequiredDate" type="date-time">
        <description>
          responseRequiredDate is the time the customer needs a response.
        </description>
      </field>
      <field name="custRequestName" type="name"></field>
      <field name="description" type="description"></field>
      <field name="maximumAmountUomId" type="id"></field>
      <field name="productStoreId" type="id"></field>
      <field name="salesChannelEnumId" type="id"></field>
      <field name="fulfillContactMechId" type="id">
        <description>
          Field to support a location of a cust request--ie, product literature sent to an address, service call at a localtion, etc.
        </description>
      </field>
      <field name="currencyUomId" type="id"></field>
      <field name="openDateTime" type="date-time">
        <description>
          Used when the customer service person, or anyone assigned to handle the incoming request, opens it for action.
          You  cantake the customer requestdate and openDateTime to see the efficiency of the customer service people.
        </description>
      </field>
      <field name="closedDateTime" type="date-time">
        <description>
          Used when the customer service person, or anyone assigned to handle the incoming request, closes it as resolution.
          In some customer response systems, the openDateTime and closedDateTime can happen more than once as the customer is not satified with the resolution.
        </description>
      </field>
      <field name="internalComment" type="comment"></field>
      <field name="reason" type="description"></field>
      <field name="createdDate" type="date-time">
        <description>
          When it is actually stored in the system.
        </description>
      </field>
      <field name="createdByUserLogin" type="id-vlong"></field>
      <field name="lastModifiedDate" type="date-time">
        <description>
          Last modified date can be till the closedDateTime which is when the customer service people, or anyone assigned to handle the incoming request, says it is resolved.
          This gives when the last action was done to see if the steps to resolve the request are happening in a timely manner.
        </description>
      </field>
      <field name="lastModifiedByUserLogin" type="id-vlong"></field>
      <prim-key field="custRequestId"/>
      <relation type="one" fk-name="CUST_REQ_TYPE" rel-entity-name="CustRequestType">
        <key-map field-name="custRequestTypeId"/>
      </relation>
      <relation type="one" fk-name="CUST_REQ_CAT" rel-entity-name="CustRequestCategory">
        <key-map field-name="custRequestCategoryId"/>
      </relation>
      <relation type="one" fk-name="CUST_REQ_STATUS" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
      <relation type="one" fk-name="CUST_REQ_FRMPTY" title="From" rel-entity-name="Party">
        <key-map field-name="fromPartyId" rel-field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="CUST_REQ_AUOM" title="MaximumAmount" rel-entity-name="Uom">
        <key-map field-name="maximumAmountUomId" rel-field-name="uomId"/>
      </relation>
      <relation type="one" fk-name="CUST_REQ_PRDS" rel-entity-name="ProductStore">
        <key-map field-name="productStoreId"/>
      </relation>
      <relation type="one" fk-name="CUST_REQ_CHANNEL" title="SalesChannel" rel-entity-name="Enumeration">
        <key-map field-name="salesChannelEnumId" rel-field-name="enumId"/>
      </relation>
      <relation type="many" rel-entity-name="CustRequestTypeAttr">
        <key-map field-name="custRequestTypeId"/>
      </relation>
      <relation type="one" fk-name="CUST_REQ_FULCM" title="Fulfill" rel-entity-name="ContactMech">
          <key-map field-name="fulfillContactMechId" rel-field-name="contactMechId"/>
      </relation>
      <relation type="one" fk-name="CUST_REQ_CUOM" title="Currency" rel-entity-name="Uom">
        <key-map field-name="currencyUomId" rel-field-name="uomId"/>
      </relation>
    </entity>
    <entity entity-name="CustRequestAttribute"
            package-name="org.apache.ofbiz.order.request"
            title="Customer Request Attribute">
      <field name="custRequestId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="attrValue" type="value"></field>
      <field name="attrDescription" type="description"></field>
      <prim-key field="custRequestId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="CUST_REQ_ATTR" rel-entity-name="CustRequest">
        <key-map field-name="custRequestId"/>
      </relation>
      <relation type="many" rel-entity-name="CustRequestTypeAttr">
        <key-map field-name="attrName"/>
      </relation>
    </entity>
    <entity entity-name="CustRequestCategory"
            package-name="org.apache.ofbiz.order.request"
            title="Customer Category Type">
      <field name="custRequestCategoryId" type="id"></field>
      <field name="custRequestTypeId" type="id"></field>
      <field name="description" type="description"></field>
      <prim-key field="custRequestCategoryId"/>
      <relation type="one" fk-name="CUST_RQCT_TYPE" rel-entity-name="CustRequestType">
        <key-map field-name="custRequestTypeId"/>
      </relation>
    </entity>
    <entity entity-name="CustRequestCommEvent"
        package-name="org.apache.ofbiz.order.request"
        title="Customer Request Communication Event">
        <field name="custRequestId" type="id"></field>
        <field name="communicationEventId" type="id"></field>
        <prim-key field="custRequestId"/>
        <prim-key field="communicationEventId"/>
        <relation type="one" fk-name="CUSTREQ_CEV_CRQ" rel-entity-name="CustRequest">
            <key-map field-name="custRequestId"/>
        </relation>
        <relation type="one" fk-name="CUSTREQ_CEV_CEV" rel-entity-name="CommunicationEvent">
            <key-map field-name="communicationEventId"/>
        </relation>
    </entity>
    <entity entity-name="CustRequestContent" package-name="org.apache.ofbiz.order.request" title="Customer Request Content">
      <field name="custRequestId" type="id"></field>
      <field name="contentId" type="id"></field>
      <field name="fromDate" type="date-time"></field>
      <field name="thruDate" type="date-time"></field>
      <prim-key field="custRequestId"/>
      <prim-key field="contentId"/>
      <prim-key field="fromDate"/>
      <relation type="one" fk-name="CUSTREQ_CNT_CUSTRQ" rel-entity-name="CustRequest">
        <key-map field-name="custRequestId"/>
      </relation>
      <relation type="one" fk-name="CUSTREQ_CNT_CNT" rel-entity-name="Content">
        <key-map field-name="contentId"/>
      </relation>
    </entity>
    <entity entity-name="CustRequestItem"
            package-name="org.apache.ofbiz.order.request"
            title="Customer Request Item">
      <field name="custRequestId" type="id"></field>
      <field name="custRequestItemSeqId" type="id"></field>
      <field name="custRequestResolutionId" type="id"></field>
      <field name="statusId" type="id"></field>
      <field name="priority" type="numeric"></field>
      <field name="sequenceNum" type="numeric"></field>
      <field name="requiredByDate" type="date-time"></field>
      <field name="productId" type="id"></field>
      <field name="quantity" type="fixed-point"></field>
      <field name="selectedAmount" type="fixed-point"></field>
      <field name="maximumAmount" type="currency-amount"></field>
      <field name="reservStart" type="date-time"></field>
      <field name="reservLength" type="fixed-point"></field>
      <field name="reservPersons" type="fixed-point"></field>
      <field name="configId" type="id"></field>
      <field name="description" type="description"></field>
      <field name="story" type="very-long"></field>
      <prim-key field="custRequestId"/>
      <prim-key field="custRequestItemSeqId"/>
      <relation type="one" fk-name="CUST_REQITM_CREQ" rel-entity-name="CustRequest">
        <key-map field-name="custRequestId"/>
      </relation>
      <relation type="one" fk-name="CUST_REQITM_STTS" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
      <relation type="one" fk-name="CUST_REQITM_RES" rel-entity-name="CustRequestResolution">
        <key-map field-name="custRequestResolutionId"/>
      </relation>
      <relation type="one" fk-name="CUST_REQITM_PRD" rel-entity-name="Product">
        <key-map field-name="productId"/>
      </relation>
    </entity>
    <entity entity-name="CustRequestNote"
            package-name="org.apache.ofbiz.order.request"
            title="Customer Request Note">
      <field name="custRequestId" type="id"></field>
      <field name="noteId" type="id"></field>
      <prim-key field="custRequestId"/>
      <prim-key field="noteId"/>
      <relation type="one" fk-name="CRQ_CR" rel-entity-name="CustRequest">
        <key-map field-name="custRequestId"/>
      </relation>
      <relation type="one" fk-name="CRQ_NOTE" rel-entity-name="NoteData">
        <key-map field-name="noteId"/>
      </relation>
    </entity>
    <entity entity-name="CustRequestItemNote"
            package-name="org.apache.ofbiz.order.request"
            title="Customer Request Item Note">
      <field name="custRequestId" type="id"></field>
      <field name="custRequestItemSeqId" type="id"></field>
      <field name="noteId" type="id"></field>
      <prim-key field="custRequestId"/>
      <prim-key field="custRequestItemSeqId"/>
      <prim-key field="noteId"/>
      <relation type="one" fk-name="CUST_REQ_ITNT" rel-entity-name="CustRequestItem">
        <key-map field-name="custRequestId"/>
        <key-map field-name="custRequestItemSeqId"/>
      </relation>
      <relation type="one" fk-name="CUST_REQ_NOTE" rel-entity-name="NoteData">
        <key-map field-name="noteId"/>
      </relation>
    </entity>
    <entity entity-name="CustRequestItemWorkEffort"
            package-name="org.apache.ofbiz.order.request"
            title="Cust Request Item Work Effort">
      <field name="custRequestId" type="id"></field>
      <field name="custRequestItemSeqId" type="id"></field>
      <field name="workEffortId" type="id"></field>
      <prim-key field="custRequestId"/>
      <prim-key field="custRequestItemSeqId"/>
      <prim-key field="workEffortId"/>
      <relation type="one" fk-name="WORK_REQFL_CSTRQ" rel-entity-name="CustRequestItem">
        <key-map field-name="custRequestId"/>
        <key-map field-name="custRequestItemSeqId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="CustRequest">
        <key-map field-name="custRequestId"/>
      </relation>
      <relation type="one" fk-name="CUST_REQ_WEFF" rel-entity-name="WorkEffort">
        <key-map field-name="workEffortId"/>
      </relation>
    </entity>
    <entity entity-name="CustRequestResolution"
            package-name="org.apache.ofbiz.order.request"
            default-resource-name="OrderEntityLabels"
            title="Customer Request Resolution">
      <field name="custRequestResolutionId" type="id"></field>
      <field name="custRequestTypeId" type="id"></field>
      <field name="description" type="description"></field>
      <prim-key field="custRequestResolutionId"/>
      <relation type="one" fk-name="CUST_RQRS_TYPE" rel-entity-name="CustRequestType">
        <key-map field-name="custRequestTypeId"/>
      </relation>
    </entity>
    <entity entity-name="CustRequestParty"
            package-name="org.apache.ofbiz.order.request"
            title="Customer Request Role">
      <field name="custRequestId" type="id"></field>
      <field name="partyId" type="id"></field>
      <field name="roleTypeId" type="id"></field>
      <field name="fromDate" type="date-time"></field>
      <field name="thruDate" type="date-time"></field>
      <prim-key field="custRequestId"/>
      <prim-key field="partyId"/>
      <prim-key field="roleTypeId"/>
      <prim-key field="fromDate"/>
      <relation type="one" fk-name="CREQ_RL_CRQST" rel-entity-name="CustRequest">
        <key-map field-name="custRequestId"/>
      </relation>
      <relation type="one" fk-name="CREQ_RL_PARTY" rel-entity-name="Party">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="RoleType">
        <key-map field-name="roleTypeId"/>
      </relation>
      <relation type="one" fk-name="CREQ_RL_PROLE" rel-entity-name="PartyRole">
        <key-map field-name="partyId"/>
        <key-map field-name="roleTypeId"/>
      </relation>
    </entity>
    <entity entity-name="CustRequestStatus"
            package-name="org.apache.ofbiz.order.request"
            title="Customer Request Status">
      <field name="custRequestStatusId" type="id"></field>
      <field name="statusId" type="id"></field>
      <field name="custRequestId" type="id"></field>
      <field name="custRequestItemSeqId" type="id"></field>
      <field name="statusDate" type="date-time"></field>
      <field name="changeByUserLoginId" type="id-vlong"></field>
      <prim-key field="custRequestStatusId"/>
      <relation type="one" fk-name="CUST_REQST_STTS" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
      <relation type="one" fk-name="CUST_REQ_STRQ" rel-entity-name="CustRequest">
        <key-map field-name="custRequestId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="CustRequestItem">
        <key-map field-name="custRequestId"/>
        <key-map field-name="custRequestItemSeqId"/>
      </relation>
      <relation type="one" fk-name="CUST_RQSTTS_USRLGN" title="ChangeBy" rel-entity-name="UserLogin">
          <key-map field-name="changeByUserLoginId" rel-field-name="userLoginId"/>
      </relation>
    </entity>
    <entity entity-name="CustRequestType"
            package-name="org.apache.ofbiz.order.request"
            default-resource-name="OrderEntityLabels"
            title="Customer Request Type">
      <field name="custRequestTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <field name="partyId" type="id"><description>party or party group(via partyRelationShip entity) responsible for responding to the communication request of this particular type</description></field>
      <prim-key field="custRequestTypeId"/>
      <relation type="one" fk-name="CUST_REQ_TYPE_PAR" title="Parent" rel-entity-name="CustRequestType">
        <key-map field-name="parentTypeId" rel-field-name="custRequestTypeId"/>
      </relation>
      <relation type="one" fk-name="CUST_PTY_PARTY" rel-entity-name="Party">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="many" fk-name="CUST_PTY_RELAT" rel-entity-name="PartyRelationship">
        <key-map field-name="partyId" rel-field-name="partyIdFrom"/>
      </relation>
    </entity>
    <entity entity-name="CustRequestTypeAttr"
            package-name="org.apache.ofbiz.order.request"
            title="Customer Request Type Attribute">
      <field name="custRequestTypeId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="description" type="description"></field>
      <prim-key field="custRequestTypeId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="CUST_REQ_TYPE_ATTR" rel-entity-name="CustRequestType">
        <key-map field-name="custRequestTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="CustRequestAttribute">
        <key-map field-name="attrName"/>
      </relation>
      <relation type="many" rel-entity-name="CustRequest">
        <key-map field-name="custRequestTypeId"/>
      </relation>
    </entity>
    <entity entity-name="CustRequestWorkEffort"
        package-name="org.apache.ofbiz.order.request"
        title="Cust Request Work Effort">
        <field name="custRequestId" type="id"></field>
        <field name="workEffortId" type="id"></field>
        <prim-key field="custRequestId"/>
        <prim-key field="workEffortId"/>
        <relation type="one" fk-name="CSTREQ_WF_CREQ" rel-entity-name="CustRequest">
            <key-map field-name="custRequestId"/>
        </relation>
        <relation type="one" fk-name="CSTREQ_WF_WEFF" rel-entity-name="WorkEffort">
            <key-map field-name="workEffortId"/>
        </relation>
    </entity>
    <entity entity-name="RespondingParty"
            package-name="org.apache.ofbiz.order.request"
            title="Responding Party">
      <field name="respondingPartySeqId" type="id"></field>
      <field name="custRequestId" type="id"></field>
      <field name="partyId" type="id"></field>
      <field name="contactMechId" type="id"></field>
      <field name="dateSent" type="date-time"></field>
      <prim-key field="respondingPartySeqId"/>
      <prim-key field="custRequestId"/>
      <prim-key field="partyId"/>
      <relation type="one" fk-name="RESP_PTY_CSREQ" rel-entity-name="CustRequest">
        <key-map field-name="custRequestId"/>
      </relation>
      <relation type="one" fk-name="RESP_PTY_PARTY" rel-entity-name="Party">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="RESP_PTY_CMECH" rel-entity-name="ContactMech">
        <key-map field-name="contactMechId"/>
      </relation>
    </entity>

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

    <entity entity-name="DesiredFeature"
            package-name="org.apache.ofbiz.order.requirement"
            title="Desired Feature">
      <field name="desiredFeatureId" type="id"></field>
      <field name="requirementId" type="id"></field>
      <field name="productFeatureId" type="id"></field>
      <field name="optionalInd" type="indicator"></field>
      <prim-key field="desiredFeatureId"/>
      <prim-key field="requirementId"/>
      <relation type="one" fk-name="DES_FEAT_REQ" rel-entity-name="Requirement">
        <key-map field-name="requirementId"/>
      </relation>
      <relation type="one" fk-name="DES_FEAT_PFEAT" rel-entity-name="ProductFeature">
        <key-map field-name="productFeatureId"/>
      </relation>
    </entity>
    <entity entity-name="OrderRequirementCommitment"
            package-name="org.apache.ofbiz.order.requirement"
            title="Order Requirement Commitment">
      <field name="orderId" type="id"></field>
      <field name="orderItemSeqId" type="id"></field>
      <field name="requirementId" type="id"></field>
      <field name="quantity" type="fixed-point"></field>
      <prim-key field="orderId"/>
      <prim-key field="orderItemSeqId"/>
      <prim-key field="requirementId"/>
      <relation type="one" fk-name="ORDREQ_CMT_ORD" rel-entity-name="OrderHeader">
        <key-map field-name="orderId"/>
      </relation>
      <relation type="one" fk-name="ORDREQ_CMT_OITM" rel-entity-name="OrderItem">
        <key-map field-name="orderId"/>
        <key-map field-name="orderItemSeqId"/>
      </relation>
      <relation type="one" fk-name="ORDREQ_CMT_REQ" rel-entity-name="Requirement">
        <key-map field-name="requirementId"/>
      </relation>
    </entity>
    <entity entity-name="Requirement"
            package-name="org.apache.ofbiz.order.requirement"
            title="Requirement">
      <field name="requirementId" type="id"></field>
      <field name="requirementTypeId" type="id"></field>
      <field name="facilityId" type="id"></field>
      <field name="deliverableId" type="id"></field>
      <field name="fixedAssetId" type="id"></field>
      <field name="productId" type="id"></field>
      <field name="statusId" type="id"></field>
      <field name="description" type="description"></field>
      <field name="requirementStartDate" type="date-time"></field>
      <field name="requiredByDate" type="date-time"></field>
      <field name="estimatedBudget" type="currency-amount"></field>
      <field name="quantity" type="fixed-point"></field>
      <field name="useCase" type="very-long"></field>
      <field name="reason" type="long-varchar"></field>
      <field name="createdDate" type="date-time"></field>
      <field name="createdByUserLogin" type="id-vlong"></field>
      <field name="lastModifiedDate" type="date-time"></field>
      <field name="lastModifiedByUserLogin" type="id-vlong"></field>
      <prim-key field="requirementId"/>
      <relation type="one" fk-name="REQ_TYPE" rel-entity-name="RequirementType">
        <key-map field-name="requirementTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="RequirementTypeAttr">
        <key-map field-name="requirementTypeId"/>
      </relation>
      <relation type="one" fk-name="REQ_FACILITY" rel-entity-name="Facility">
        <key-map field-name="facilityId"/>
      </relation>
      <relation type="one" fk-name="REQ_DELIVERABLE" rel-entity-name="Deliverable">
        <key-map field-name="deliverableId"/>
      </relation>
      <relation type="one" fk-name="REQ_FIXED_ASSET" rel-entity-name="FixedAsset">
        <key-map field-name="fixedAssetId"/>
      </relation>
      <relation type="one" fk-name="REQ_PRODUCT" rel-entity-name="Product">
        <key-map field-name="productId"/>
      </relation>
      <relation type="one" fk-name="REQ_STTS" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
    </entity>
    <entity entity-name="RequirementAttribute"
            package-name="org.apache.ofbiz.order.requirement"
            title="Requirement Attribute">
      <field name="requirementId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="attrValue" type="value"></field>
      <field name="attrDescription" type="description"></field>
      <prim-key field="requirementId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="REQ_ATTR" rel-entity-name="Requirement">
        <key-map field-name="requirementId"/>
      </relation>
      <relation type="many" rel-entity-name="RequirementTypeAttr">
        <key-map field-name="attrName"/>
      </relation>
    </entity>
    <entity entity-name="RequirementBudgetAllocation"
            package-name="org.apache.ofbiz.order.requirement"
            title="Requirement Budget Allocation">
      <field name="budgetId" type="id"></field>
      <field name="budgetItemSeqId" type="id"></field>
      <field name="requirementId" type="id"></field>
      <field name="amount" type="currency-amount"></field>
      <prim-key field="budgetId"/>
      <prim-key field="budgetItemSeqId"/>
      <prim-key field="requirementId"/>
      <relation type="one-nofk" rel-entity-name="Budget">
        <key-map field-name="budgetId"/>
      </relation>
      <relation type="one" fk-name="REQ_BDGTAL_BITM" rel-entity-name="BudgetItem">
        <key-map field-name="budgetId"/>
        <key-map field-name="budgetItemSeqId"/>
      </relation>
      <relation type="one" fk-name="REQ_BDGTAL_REQ" rel-entity-name="Requirement">
        <key-map field-name="requirementId"/>
      </relation>
    </entity>
    <entity entity-name="RequirementCustRequest"
            package-name="org.apache.ofbiz.order.requirement"
            title="Requirement Customer Request">
      <field name="custRequestId" type="id"></field>
      <field name="custRequestItemSeqId" type="id"></field>
      <field name="requirementId" type="id"></field>
      <prim-key field="custRequestId"/>
      <prim-key field="custRequestItemSeqId"/>
      <prim-key field="requirementId"/>
      <relation type="one-nofk" rel-entity-name="CustRequest">
        <key-map field-name="custRequestId"/>
      </relation>
      <relation type="one" fk-name="REQ_CSREQ_CRITM" rel-entity-name="CustRequestItem">
        <key-map field-name="custRequestId"/>
        <key-map field-name="custRequestItemSeqId"/>
      </relation>
      <relation type="one" fk-name="REQ_CSREQ_REQ" rel-entity-name="Requirement">
        <key-map field-name="requirementId"/>
      </relation>
    </entity>
    <entity entity-name="RequirementRole"
            package-name="org.apache.ofbiz.order.requirement"
            title="Requirement Role">
      <field name="requirementId" type="id"></field>
      <field name="partyId" type="id"></field>
      <field name="roleTypeId" type="id"></field>
      <field name="fromDate" type="date-time"></field>
      <field name="thruDate" type="date-time"></field>
      <prim-key field="requirementId"/>
      <prim-key field="partyId"/>
      <prim-key field="roleTypeId"/>
      <prim-key field="fromDate"/>
      <relation type="one" fk-name="REQ_ROLE_REQ" rel-entity-name="Requirement">
        <key-map field-name="requirementId"/>
      </relation>
      <relation type="one" fk-name="REQ_ROLE_PRTY" rel-entity-name="Party">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="one" fk-name="REQ_ROLE_PROLE" rel-entity-name="PartyRole">
        <key-map field-name="partyId"/>
        <key-map field-name="roleTypeId"/>
      </relation>
    </entity>
    <entity entity-name="RequirementStatus"
            package-name="org.apache.ofbiz.order.requirement"
            title="Requirement Status">
      <field name="requirementId" type="id"></field>
      <field name="statusId" type="id"></field>
      <field name="statusDate" type="date-time"></field>
      <field name="changeByUserLoginId" type="id-vlong"></field>
      <prim-key field="requirementId"/>
      <prim-key field="statusId"/>
      <relation type="one" fk-name="REQ_STTS_REQ" rel-entity-name="Requirement">
        <key-map field-name="requirementId"/>
      </relation>
      <relation type="one" fk-name="REQ_STTS_STTS" rel-entity-name="StatusItem">
        <key-map field-name="statusId"/>
      </relation>
      <relation type="one" fk-name="REQ_STTS_USRLGN" title="ChangeBy" rel-entity-name="UserLogin">
          <key-map field-name="changeByUserLoginId" rel-field-name="userLoginId"/>
      </relation>
    </entity>
    <entity entity-name="RequirementType"
            package-name="org.apache.ofbiz.order.requirement"
            default-resource-name="OrderEntityLabels"
            title="Requirement Type">
      <field name="requirementTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="requirementTypeId"/>
      <relation type="one" fk-name="REQ_TYPE_PARENT" title="Parent" rel-entity-name="RequirementType">
        <key-map field-name="parentTypeId" rel-field-name="requirementTypeId"/>
      </relation>
    </entity>
    <entity entity-name="RequirementTypeAttr"
            package-name="org.apache.ofbiz.order.requirement"
            title="Requirement Type Attribute">
      <field name="requirementTypeId" type="id"></field>
      <field name="attrName" type="id-long"></field>
      <field name="description" type="description"></field>
      <prim-key field="requirementTypeId"/>
      <prim-key field="attrName"/>
      <relation type="one" fk-name="REQ_TYPE_ATTR" rel-entity-name="RequirementType">
        <key-map field-name="requirementTypeId"/>
      </relation>
      <relation type="many" rel-entity-name="RequirementAttribute">
        <key-map field-name="attrName"/>
      </relation>
      <relation type="many" rel-entity-name="Requirement">
        <key-map field-name="requirementTypeId"/>
      </relation>
    </entity>
    <entity entity-name="WorkReqFulfType"
            package-name="org.apache.ofbiz.order.requirement"
            default-resource-name="OrderEntityLabels"
            title="Work Requirement Fulfillment Type">
      <field name="workReqFulfTypeId" type="id"></field>
      <field name="description" type="description"></field>
      <prim-key field="workReqFulfTypeId"/>
    </entity>
    <entity entity-name="WorkRequirementFulfillment"
            package-name="org.apache.ofbiz.order.requirement"
            title="Work Requirement Fulfillment">
      <field name="requirementId" type="id"></field>
      <field name="workEffortId" type="id"></field>
      <field name="workReqFulfTypeId" type="id"></field>
      <prim-key field="requirementId"/>
      <prim-key field="workEffortId"/>
      <relation type="one" fk-name="WORK_REQFL_REQ" rel-entity-name="Requirement">
        <key-map field-name="requirementId"/>
      </relation>
      <relation type="one" fk-name="WORK_REQFL_WEFF" rel-entity-name="WorkEffort">
        <key-map field-name="workEffortId"/>
      </relation>
      <relation type="one" fk-name="WORK_REQFL_WRFT" rel-entity-name="WorkReqFulfType">
        <key-map field-name="workReqFulfTypeId"/>
      </relation>
    </entity>

    <!-- ========================================================= -->
    <!-- org.apache.ofbiz.order.return -->
    <!-- ========================================================= -->
    <entity entity-name="ReturnAdjustment"
            package-name="org.apache.ofbiz.order.return"
            never-cache="true"
            title="Return Adjustment">
      <description>Tax, shipping, and promotional adjustments which are carried over from the order to the return.
        Note that both includeInTax and includeInShipping should default to true, except in the case where this adjustment is a tax or shipping adjustment
        then should be ignored.</description>
      <field name="returnAdjustmentId" type="id"></field>
      <field name="returnAdjustmentTypeId" type="id"></field>
      <field name="returnId" type="id"></field>
      <field name="returnItemSeqId" type="id"></field>
      <field name="shipGroupSeqId" type="id"></field>
      <field name="comments" type="comment"></field>
      <field name="description" type="description"></field>
      <field name="returnTypeId" type="id">
          <description>actually used for disbursement type: store credit, cash refund, exchange</description>
      </field>
      <field name="orderAdjustmentId" type="id"></field>
      <field name="amount" type="currency-precise"></field>
      <field name="productPromoId" type="id"></field>
      <field name="productPromoRuleId" type="id"></field>
      <field name="productPromoActionSeqId" type="id"></field>
      <field name="productFeatureId" type="id"></field>
      <field name="correspondingProductId" type="id"></field>
      <field name="taxAuthorityRateSeqId" type="id"></field>
      <field name="sourceReferenceId" type="id-long"></field>
      <field name="sourcePercentage" type="fixed-point">
          <description>for tax entries this is the tax percentage</description>
      </field>
      <field name="customerReferenceId" type="id-long">
          <description>for tax entries this is partyTaxId</description>
      </field>
      <field name="primaryGeoId" type="id">
          <description>for tax entries this is the primary jurisdiction Geo (the smallest or most local Geo that this tax is for, usually a state/province, perhaps a county or a city)</description>
       </field>
      <field name="secondaryGeoId" type="id">
          <description>for tax entries this is the secondary jurisdiction Geo (usually a country, or other Geo that the primary is within)</description>
      </field>
      <field name="exemptAmount" type="currency-amount">
          <description>an amount that would normally apply, but not to this order; for tax exemption represents the what the tax would have been</description>
      </field>
      <field name="taxAuthGeoId" type="id">
          <description>these taxAuth fields deprecate the primaryGeoId and secondaryGeoId fields and will be used with the newer tax calc stuff</description>
      </field>
      <field name="taxAuthPartyId" type="id"></field>
      <field name="overrideGlAccountId" type="id">
          <description>used to specify the override or actual glAccountId used for the adjustment, avoids problems if configuration changes after initial posting, etc</description>
      </field>
      <field name="includeInTax" type="indicator"></field>
      <field name="includeInShipping" type="indicator"></field>
      <field name="createdDate" type="date-time"></field>
      <field name="createdByUserLogin" type="id-vlong"></field>
      <field name="lastModifiedDate" type="date-time"></field>
      <field name="lastModifiedByUserLogin" type="id-vlong"></field>
      <prim-key field="returnAdjustmentId"/>
      <relation type="one" fk-name="RETURN_ADJ_TYPE" rel-entity-name="ReturnAdjustmentType">
        <key-map field-name="returnAdjustmentTypeId"/>
      </relation>
      <relation type="one" fk-name="RETURN_ADJ_RHEAD" rel-entity-name="ReturnHeader">
        <key-map field-name="returnId"/>
      </relation>
      <relation type="one" fk-name="RETURN_ADJ_USERL" rel-entity-name="UserLogin">
        <key-map field-name="createdByUserLogin" rel-field-name="userLoginId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="ReturnItem">
        <key-map field-name="returnId"/>
        <key-map field-name="returnItemSeqId"/>
      </relation>
      <relation type="one" fk-name="RETURN_ADJ_PROMO" rel-entity-name="ProductPromo">
        <key-map field-name="productPromoId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="ProductPromoRule">
        <key-map field-name="productPromoId"/>
        <key-map field-name="productPromoRuleId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="ProductPromoAction">
        <key-map field-name="productPromoId"/>
        <key-map field-name="productPromoRuleId"/>
        <key-map field-name="productPromoActionSeqId"/>
      </relation>
      <relation type="one" fk-name="RETURN_ADJ_PRGEO" title="Primary" rel-entity-name="Geo">
        <key-map field-name="primaryGeoId" rel-field-name="geoId"/>
      </relation>
      <relation type="one" fk-name="RETURN_ADJ_SCGEO" title="Secondary" rel-entity-name="Geo">
        <key-map field-name="secondaryGeoId" rel-field-name="geoId"/>
      </relation>
      <relation type="one" fk-name="RETURN_ADJ_TXA" rel-entity-name="TaxAuthority">
        <key-map field-name="taxAuthGeoId"/>
        <key-map field-name="taxAuthPartyId"/>
      </relation>
      <relation type="one" fk-name="RETURN_ADJ_OGLA" title="Override" rel-entity-name="GlAccount">
        <key-map field-name="overrideGlAccountId" rel-field-name="glAccountId"/>
      </relation>
      <relation type="one" fk-name="RET_ADJ_RTN_TYPE" rel-entity-name="ReturnType">
            <key-map field-name="returnTypeId"/>
      </relation>
      <relation type="one" fk-name="RETURN_ADJ_ORDADJ" rel-entity-name="OrderAdjustment">
            <key-map field-name="orderAdjustmentId"/>
      </relation>
      <relation type="one" fk-name="RETURN_ADJ_TARP" rel-entity-name="TaxAuthorityRateProduct">
        <key-map field-name="taxAuthorityRateSeqId"/>
      </relation>
    </entity>
    <entity entity-name="ReturnAdjustmentType"
            package-name="org.apache.ofbiz.order.return"
            default-resource-name="OrderEntityLabels"
            title="Return Adjustment Type">
      <field name="returnAdjustmentTypeId" type="id"></field>
      <field name="parentTypeId" type="id"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="returnAdjustmentTypeId"/>
      <relation type="one" fk-name="RETURN_ADJ_TYPPAR" title="Parent" rel-entity-name="ReturnAdjustmentType">
        <key-map field-name="parentTypeId" rel-field-name="returnAdjustmentTypeId"/>
      </relation>
    </entity>
    <entity entity-name="ReturnHeader"
            package-name="org.apache.ofbiz.order.return"
            title="Return">
        <field name="returnId" type="id"></field>
        <field name="returnHeaderTypeId" type="id"></field>
        <field name="statusId" type="id"></field>
        <field name="createdBy" type="id-vlong"></field>
        <field name="fromPartyId" type="id"></field>
        <field name="toPartyId" type="id"></field>
        <field name="paymentMethodId" type="id"></field>
        <field name="finAccountId" type="id"></field>
        <field name="billingAccountId" type="id"></field>
        <field name="entryDate" type="date-time"></field>
        <field name="originContactMechId" type="id"></field>
        <field name="destinationFacilityId" type="id"></field>
        <field name="needsInventoryReceive" type="indicator"></field>
        <field name="currencyUomId" type="id"></field>
        <field name="supplierRmaId" type="id"></field>
        <prim-key field="returnId"/>
        <relation type="one" fk-name="RTN_HEAD_TYPE" rel-entity-name="ReturnHeaderType">
            <key-map field-name="returnHeaderTypeId"/>
        </relation>
        <relation type="one" fk-name="RTN_FROM_PARTY" rel-entity-name="Party">
            <key-map field-name="fromPartyId" rel-field-name="partyId"/>
        </relation>
        <relation type="one" fk-name="RTN_TO_PARTY" title="To" rel-entity-name="Party">
            <key-map field-name="toPartyId" rel-field-name="partyId"/>
        </relation>
        <relation type="one" fk-name="RTN_TO_BACT" rel-entity-name="BillingAccount">
            <key-map field-name="billingAccountId"/>
        </relation>
        <relation type="one" fk-name="RTN_TO_FACT" rel-entity-name="FinAccount">
            <key-map field-name="finAccountId"/>
        </relation>
        <relation type="one" fk-name="RTN_TO_PAYMETH" rel-entity-name="PaymentMethod">
            <key-map field-name="paymentMethodId"/>
        </relation>
        <relation type="one" fk-name="RTN_TO_FACILITY" rel-entity-name="Facility">
            <key-map field-name="destinationFacilityId" rel-field-name="facilityId"/>
        </relation>
        <relation type="one" fk-name="RTN_FROM_CTM" rel-entity-name="ContactMech">
            <key-map field-name="originContactMechId" rel-field-name="contactMechId"/>
        </relation>
        <relation type="one-nofk" rel-entity-name="PostalAddress">
            <key-map field-name="originContactMechId" rel-field-name="contactMechId"/>
        </relation>
        <relation type="one" fk-name="RTN_STTS_ITEM" rel-entity-name="StatusItem">
            <key-map field-name="statusId"/>
        </relation>
        <relation type="one" fk-name="RTN_HDR_CUOM" rel-entity-name="Uom">
            <key-map field-name="currencyUomId" rel-field-name="uomId"/>
        </relation>
        <relation type="one-nofk" rel-entity-name="UserLogin">
            <key-map field-name="createdBy" rel-field-name="userLoginId"/>
        </relation>
    </entity>
    <entity entity-name="ReturnHeaderType"
            package-name="org.apache.ofbiz.order.return"
            title="Return Header Type">
        <field name="returnHeaderTypeId" type="id"></field>
        <field name="parentTypeId" type="id"></field>
        <field name="description" type="description"></field>
        <prim-key field="returnHeaderTypeId"/>
        <relation type="one" fk-name="RTHEAD_TYPE_PARENT" title="Parent" rel-entity-name="ReturnHeaderType">
          <key-map field-name="parentTypeId" rel-field-name="returnHeaderTypeId"/>
        </relation>
    </entity>
    <entity entity-name="ReturnItem"
            package-name="org.apache.ofbiz.order.return"
            title="Return Item">
        <field name="returnId" type="id"></field>
        <field name="returnItemSeqId" type="id"></field>
        <field name="returnReasonId" type="id" enable-audit-log="true">
            <description>why item is returned: did not like, wrong item, damaged, etc. etc.</description>
        </field>
        <field name="returnTypeId" type="id" enable-audit-log="true">
            <description>actually used for disbursement type: store credit, cash refund, exchange</description>
        </field>
        <field name="returnItemTypeId" type="id">
            <description>what is returned: a product, a service, etc</description>
        </field>
        <field name="productId" type="id">
            <description>we need this field to be able to figure out net sales of a product</description>
        </field>
        <field name="description" type="description"></field>
        <field name="orderId" type="id"></field>
        <field name="orderItemSeqId" type="id"></field>
        <field name="statusId" type="id"></field>
        <field name="expectedItemStatus" type="id"></field>
        <field name="returnQuantity" type="fixed-point" enable-audit-log="true"><description>promised by the customer</description></field>
        <field name="receivedQuantity" type="fixed-point" enable-audit-log="true"><description>actually received from the customer</description></field>
        <field name="returnPrice" type="currency-amount" enable-audit-log="true"></field>
        <field name="returnItemResponseId" type="id"></field>
        <prim-key field="returnId"/>
        <prim-key field="returnItemSeqId"/>
        <relation type="one" fk-name="RTN_ITEM_RTN" rel-entity-name="ReturnHeader">
            <key-map field-name="returnId"/>
        </relation>
        <relation type="one" fk-name="RTN_ITEM_REASON" rel-entity-name="ReturnReason">
            <key-map field-name="returnReasonId"/>
        </relation>
        <relation type="one" fk-name="RTN_TYPE" rel-entity-name="ReturnType">
            <key-map field-name="returnTypeId"/>
        </relation>
        <relation type="one" fk-name="RTN_ITEM_TYPE" rel-entity-name="ReturnItemType"> <!-- this is new -->
            <key-map field-name="returnItemTypeId"/>
        </relation>
        <relation type="one" fk-name="RTN_ITEM_RESP" rel-entity-name="ReturnItemResponse">
            <key-map field-name="returnItemResponseId"/>
        </relation>
        <relation type="one" fk-name="RTN_ITEM_ODR" rel-entity-name="OrderHeader">
            <key-map field-name="orderId"/>
        </relation>
        <relation type="one" fk-name="RTN_ITEM_ODRIT" rel-entity-name="OrderItem">
            <key-map field-name="orderId"/>
            <key-map field-name="orderItemSeqId"/>
        </relation>
        <relation type="one" fk-name="RTN_ITEM_STTSIT" rel-entity-name="StatusItem">
            <key-map field-name="statusId"/>
        </relation>
        <relation type="one" fk-name="RTN_ITEM_ITSTT" title="Inventory" rel-entity-name="StatusItem">
            <key-map field-name="expectedItemStatus" rel-field-name="statusId"/>
        </relation>
        <relation type="one" fk-name="RTN_ITEM_PROD" rel-entity-name="Product">
            <key-map field-name="productId"/>
        </relation>
        <relation type="many" fk-name="RTN_ITEM_OISGIR" rel-entity-name="OrderItemShipGrpInvRes">
            <key-map field-name="orderId"/>
            <key-map field-name="orderItemSeqId"/>
        </relation>
        <index name="RTN_ITM_BYORDITM">
            <index-field name="orderId"/>
            <index-field name="orderItemSeqId"/>
        </index>
    </entity>
    <entity entity-name="ReturnItemResponse"
            package-name="org.apache.ofbiz.order.return"
            never-cache="true"
            title="The Return Item Response">
        <description>Records what was done with a return: whether a replacement order, a payment, or a billing account credit was issued</description>
        <field name="returnItemResponseId" type="id"></field>
        <field name="orderPaymentPreferenceId" type="id"></field>
        <field name="replacementOrderId" type="id"></field>
        <field name="paymentId" type="id"></field>
        <field name="billingAccountId" type="id"></field>
        <field name="finAccountTransId" type="id"></field>
        <field name="responseAmount" type="currency-amount"></field>
        <field name="responseDate" type="date-time"></field>
        <prim-key field="returnItemResponseId"/>
        <relation type="one" fk-name="RTN_PAY_ORDPAYPF" rel-entity-name="OrderPaymentPreference">
            <key-map field-name="orderPaymentPreferenceId"/>
        </relation>
        <relation type="one" fk-name="RTN_RESP_NEWORD" title="Replacement" rel-entity-name="OrderHeader">
            <key-map field-name="replacementOrderId" rel-field-name="orderId"/>
        </relation>
        <relation type="one" fk-name="RTN_PAY_PAYMENT" rel-entity-name="Payment">
            <key-map field-name="paymentId"/>
        </relation>
        <relation type="one" fk-name="RTN_PAY_BACT" rel-entity-name="BillingAccount">
            <key-map field-name="billingAccountId"/>
        </relation>
        <relation type="one" fk-name="RTN_PAY_FINACTTX" rel-entity-name="FinAccountTrans">
            <key-map field-name="finAccountTransId"/>
        </relation>
    </entity>
    <entity entity-name="ReturnItemType"
            package-name="org.apache.ofbiz.order.return"
            title="Return Item Type">
        <description>ReturnItemType records the type of a ReturnItem</description>
        <field name="returnItemTypeId" type="id"></field>
        <field name="parentTypeId" type="id"></field>
        <field name="description" type="description"></field>
        <prim-key field="returnItemTypeId"/>
        <relation type="one" fk-name="RETURN_ITEM_TYPPAR" title="Parent" rel-entity-name="ReturnItemType">
          <key-map field-name="parentTypeId" rel-field-name="returnItemTypeId"/>
        </relation>
    </entity>
    <entity entity-name="ReturnItemTypeMap"
            package-name="org.apache.ofbiz.order.return"
            title="Return Item Type Map">
        <description>Mapping between productTypeId and returnItemTypeId for product order items, orderItemTypeId and returnItemTypeId for other
          order items, or orderAdjustmentTypeId and returnAdjustmentTypeId.  Separate mappings for different types of returns (customer vs. vendor)</description>
      <field name="returnItemMapKey" type="id"></field>
      <field name="returnHeaderTypeId" type="id"></field>
      <field name="returnItemTypeId" type="id"></field>
      <prim-key field="returnItemMapKey"/>
      <prim-key field="returnHeaderTypeId"/>
      <relation type="one-nofk" rel-entity-name="ReturnItemType">
        <key-map field-name="returnItemTypeId"/>
      </relation>
      <relation type="one" fk-name="RETITMMAP_RETTYP" rel-entity-name="ReturnHeaderType">
        <key-map field-name="returnHeaderTypeId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="ReturnAdjustmentType">
        <key-map field-name="returnItemTypeId" rel-field-name="returnAdjustmentTypeId"/>
      </relation>
    </entity>
    <entity entity-name="ReturnReason"
            package-name="org.apache.ofbiz.order.return"
            default-resource-name="OrderEntityLabels"
            title="Return Reason">
        <field name="returnReasonId" type="id"></field>
        <field name="description" type="description"></field>
        <field name="sequenceId" type="id"></field>
        <prim-key field="returnReasonId"/>
    </entity>
    <entity entity-name="ReturnStatus"
            package-name="org.apache.ofbiz.order.return"
            title="Return Status History">
        <field name="returnStatusId" type="id"></field>
        <field name="statusId" type="id"></field>
        <field name="returnId" type="id"></field>
        <field name="returnItemSeqId" type="id"></field>
        <field name="changeByUserLoginId" type="id-vlong"></field>
        <field name="statusDatetime" type="date-time"></field>
        <prim-key field="returnStatusId"/>
        <relation type="one" fk-name="RTN_STTS_STTS" rel-entity-name="StatusItem">
            <key-map field-name="statusId"/>
        </relation>
        <relation type="one" fk-name="RTN_STTS_RTN" rel-entity-name="ReturnHeader">
            <key-map field-name="returnId"/>
        </relation>
        <relation type="one-nofk" rel-entity-name="ReturnItem">
            <key-map field-name="returnId"/>
            <key-map field-name="returnItemSeqId"/>
        </relation>
        <relation type="one" fk-name="RTN_STTS_USRLGN" title="ChangeBy" rel-entity-name="UserLogin">
            <key-map field-name="changeByUserLoginId" rel-field-name="userLoginId"/>
        </relation>
    </entity>
    <entity entity-name="ReturnType"
            package-name="org.apache.ofbiz.order.return"
            default-resource-name="OrderEntityLabels"
            title="Return Type">
        <field name="returnTypeId" type="id"></field>
        <field name="description" type="description"></field>
        <field name="sequenceId" type="id"></field>
        <prim-key field="returnTypeId"/>
    </entity>
    <entity entity-name="ReturnItemBilling"
            package-name="org.apache.ofbiz.order.return"
            never-cache="true"
            title="Records the quantity and amount returned to an inventory item from a return item.">
      <field name="returnId" type="id"></field>
      <field name="returnItemSeqId" type="id"></field>
      <field name="invoiceId" type="id"></field>
      <field name="invoiceItemSeqId" type="id"></field>
      <field name="shipmentReceiptId" type="id"></field>
      <field name="quantity" type="fixed-point"></field>
      <field name="amount" type="currency-amount"></field>
      <prim-key field="returnId"/>
      <prim-key field="returnItemSeqId"/>
      <prim-key field="invoiceId"/>
      <prim-key field="invoiceItemSeqId"/>
      <relation type="one" fk-name="RTN_ITBLNG_RHDR" rel-entity-name="ReturnHeader">
        <key-map field-name="returnId"/>
      </relation>
      <relation type="one" fk-name="RTN_ITBLNG_RITM" rel-entity-name="ReturnItem">
        <key-map field-name="returnId"/>
        <key-map field-name="returnItemSeqId"/>
      </relation>
      <relation type="one-nofk" fk-name="RITBL_INVOICE" rel-entity-name="Invoice">
        <key-map field-name="invoiceId"/>
      </relation>
      <relation type="one" fk-name="RETURN_ITBLNG_IITM" rel-entity-name="InvoiceItem">
        <key-map field-name="invoiceId"/>
        <key-map field-name="invoiceItemSeqId"/>
      </relation>
      <relation type="one" fk-name="RITBL_SHIPRCPT" rel-entity-name="ShipmentReceipt">
        <key-map field-name="shipmentReceiptId" rel-field-name="receiptId"/>
      </relation>
    </entity>
    <entity entity-name="ReturnItemShipment"
            package-name="org.apache.ofbiz.order.return"
            title="Return Item And Shipment Association">
      <field name="returnId" type="id"></field>
      <field name="returnItemSeqId" type="id"></field>
      <field name="shipmentId" type="id"></field>
      <field name="shipmentItemSeqId" type="id"></field>
      <field name="quantity" type="fixed-point"></field>
      <prim-key field="returnId"/>
      <prim-key field="returnItemSeqId"/>
      <prim-key field="shipmentId"/>
      <prim-key field="shipmentItemSeqId"/>
      <relation type="one" fk-name="RIT_SHPMT_RHDR" rel-entity-name="ReturnHeader">
        <key-map field-name="returnId"/>
      </relation>
      <relation type="one" fk-name="RIT_SHPMT_RITM" rel-entity-name="ReturnItem">
        <key-map field-name="returnId"/>
        <key-map field-name="returnItemSeqId"/>
      </relation>
      <relation type="one" fk-name="RIT_SHPMT_SHPMT" rel-entity-name="Shipment">
        <key-map field-name="shipmentId"/>
      </relation>
      <relation type="one" fk-name="RIT_SHPMT_SHPITM" rel-entity-name="ShipmentItem">
        <key-map field-name="shipmentId"/>
        <key-map field-name="shipmentItemSeqId"/>
      </relation>
    </entity>

    <entity entity-name="ReturnContactMech"
            package-name="org.apache.ofbiz.order.return"
            never-cache="true"
            title="Retrun Contact Mechanism">
        <field name="returnId" type="id"></field>
        <field name="contactMechPurposeTypeId" type="id"></field>
        <field name="contactMechId" type="id"></field>
        <prim-key field="returnId"/>
        <prim-key field="contactMechPurposeTypeId"/>
        <prim-key field="contactMechId"/>
        <relation type="one" fk-name="RETURN_CMECH_HDR" rel-entity-name="ReturnHeader">
            <key-map field-name="returnId"/>
        </relation>
        <relation type="one" fk-name="RETURN_CMECH_CM" rel-entity-name="ContactMech">
            <key-map field-name="contactMechId"/>
        </relation>
        <relation type="one" fk-name="RETURN_CMECH_CMPT" rel-entity-name="ContactMechPurposeType">
            <key-map field-name="contactMechPurposeTypeId"/>
        </relation>
    </entity>
    
    <entity entity-name="CommunicationEventReturn"
            package-name="org.apache.ofbiz.order.return"
            title="Communication Event Return">
      <field name="returnId" type="id"></field>
      <field name="communicationEventId" type="id"></field>
      <prim-key field="returnId"/>
      <prim-key field="communicationEventId"/>
      <relation type="one" fk-name="COMEV_ORDER_RETURN" rel-entity-name="ReturnHeader">
        <key-map field-name="returnId"/>
      </relation>
      <relation type="one" fk-name="COMEV_RETURN_CMEV" rel-entity-name="CommunicationEvent">
        <key-map field-name="communicationEventId"/>
      </relation>
    </entity>

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

    <entity entity-name="CartAbandonedLine"
            package-name="org.apache.ofbiz.order.shoppingcart"
            never-cache="true"
            title="Order Abandoned Line">
      <field name="visitId" type="id"></field>
      <field name="cartAbandonedLineSeqId" type="id"></field>
      <field name="productId" type="id"></field>
      <field name="prodCatalogId" type="id"></field>
      <field name="quantity" type="fixed-point"></field>
      <field name="reservStart" type="date-time"></field>
      <field name="reservLength" type="fixed-point"></field>
      <field name="reservPersons" type="fixed-point"></field>
      <field name="unitPrice" type="currency-amount"></field>
      <field name="reserv2ndPPPerc" type="fixed-point"/>
      <field name="reservNthPPPerc" type="fixed-point"/>
      <field name="configId" type="id"></field>
      <field name="totalWithAdjustments" type="currency-amount"></field>
      <field name="wasReserved" type="indicator"></field>
      <prim-key field="visitId"/>
      <prim-key field="cartAbandonedLineSeqId"/>
      <relation type="one" fk-name="CART_ABLN_PRD" rel-entity-name="Product">
        <key-map field-name="productId"/>
      </relation>
      <relation type="one" fk-name="CART_ABLN_PRDCAT" rel-entity-name="ProdCatalog">
        <key-map field-name="prodCatalogId"/>
      </relation>
    </entity>

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

    <entity entity-name="ShoppingList"
            package-name="org.apache.ofbiz.order.shoppinglist"
            title="Shopping List">
      <field name="shoppingListId" type="id"></field>
      <field name="shoppingListTypeId" type="id"></field>
      <field name="parentShoppingListId" type="id"></field>
      <field name="productStoreId" type="id"></field>
      <field name="visitorId" type="id"></field>
      <field name="partyId" type="id"></field>
      <field name="listName" type="name"></field>
      <field name="description" type="description"></field>
      <field name="isPublic" type="indicator"></field>
      <field name="isActive" type="indicator"></field>
      <field name="currencyUom" type="id"></field>
      <field name="shipmentMethodTypeId" type="id"></field>
      <field name="carrierPartyId" type="id"></field>
      <field name="carrierRoleTypeId" type="id"></field>
      <field name="contactMechId" type="id"></field>
      <field name="paymentMethodId" type="id"></field>
      <field name="recurrenceInfoId" type="id"></field>
      <field name="lastOrderedDate" type="date-time"></field>
      <field name="lastAdminModified" type="date-time"></field>
      <field name="productPromoCodeId" type="id"></field>
      <prim-key field="shoppingListId"/>
      <relation type="one" fk-name="SHLIST_PARENT" title="Parent" rel-entity-name="ShoppingList">
        <key-map field-name="parentShoppingListId" rel-field-name="shoppingListId"/>
      </relation>
      <relation type="many" title="Sibling" rel-entity-name="ShoppingList">
        <key-map field-name="parentShoppingListId"/>
      </relation>
      <relation type="one" fk-name="SHLIST_TYPE" rel-entity-name="ShoppingListType">
        <key-map field-name="shoppingListTypeId"/>
      </relation>
      <relation type="one" fk-name="SHLIST_PRDS" rel-entity-name="ProductStore">
        <key-map field-name="productStoreId"/>
      </relation>
      <relation type="one" fk-name="SHLIST_PTY" rel-entity-name="Party">
        <key-map field-name="partyId"/>
      </relation>
      <relation type="many" fk-name="SHLIST_PSSM" rel-entity-name="ProductStoreShipmentMeth">
        <key-map field-name="productStoreId"/>
        <key-map field-name="shipmentMethodTypeId"/>
        <key-map field-name="carrierPartyId" rel-field-name="partyId"/>
        <key-map field-name="carrierRoleTypeId" rel-field-name="roleTypeId"/>
      </relation>
      <relation type="one" fk-name="SHLIST_CSSM" rel-entity-name="CarrierShipmentMethod">
        <key-map field-name="shipmentMethodTypeId"/>
        <key-map field-name="carrierPartyId" rel-field-name="partyId"/>
        <key-map field-name="carrierRoleTypeId" rel-field-name="roleTypeId"/>
      </relation>
      <relation type="one" fk-name="SHLIST_CMECH" rel-entity-name="ContactMech">
        <key-map field-name="contactMechId"/>
      </relation>
      <relation type="one-nofk" rel-entity-name="PostalAddress">
        <key-map field-name="contactMechId"/>
      </relation>
      <relation type="one" fk-name="SHLIST_PYMETH" rel-entity-name="PaymentMethod">
        <key-map field-name="paymentMethodId"/>
      </relation>
      <relation type="one" fk-name="SHLIST_RECINFO" rel-entity-name="RecurrenceInfo">
        <key-map field-name="recurrenceInfoId"/>
      </relation>
        <relation type="one" fk-name="SHLIST_PRMCD" rel-entity-name="ProductPromoCode">
            <key-map field-name="productPromoCodeId"/>
        </relation>
    </entity>
    <entity entity-name="ShoppingListItem"
            package-name="org.apache.ofbiz.order.shoppinglist"
            title="Shopping List Item">
      <field name="shoppingListId" type="id"></field>
      <field name="shoppingListItemSeqId" type="id"></field>
      <field name="productId" type="id"></field>
      <field name="quantity" type="fixed-point"></field>
      <field name="modifiedPrice" type="currency-precise"/>
      <field name="reservStart" type="date-time"></field>
      <field name="reservLength" type="fixed-point"></field>
      <field name="reservPersons" type="fixed-point"></field>
      <field name="quantityPurchased" type="fixed-point"></field>
      <field name="configId" type="id"></field>
      <prim-key field="shoppingListId"/>
      <prim-key field="shoppingListItemSeqId"/>
      <relation type="one" fk-name="SHLIST_ITEM_LIST" rel-entity-name="ShoppingList">
        <key-map field-name="shoppingListId"/>
      </relation>
      <relation type="one" fk-name="SHLIST_ITEM_PROD" rel-entity-name="Product">
        <key-map field-name="productId"/>
      </relation>
    </entity>
    <entity entity-name="ShoppingListItemSurvey"
            package-name="org.apache.ofbiz.order.shoppinglist"
            title="Shopping List Item">
      <field name="shoppingListId" type="id"></field>
      <field name="shoppingListItemSeqId" type="id"></field>
      <field name="surveyResponseId" type="id"></field>
      <prim-key field="shoppingListId"/>
      <prim-key field="shoppingListItemSeqId"/>
      <prim-key field="surveyResponseId"/>
      <relation type="one" fk-name="SHLIST_ITSUR_LIST" rel-entity-name="ShoppingList">
        <key-map field-name="shoppingListId"/>
      </relation>
      <relation type="one" fk-name="SHLIST_ITSUR_ITEM" rel-entity-name="ShoppingListItem">
        <key-map field-name="shoppingListId"/>
        <key-map field-name="shoppingListItemSeqId"/>
      </relation>
      <relation type="one" fk-name="SHLIST_ITSUR_RESP" rel-entity-name="SurveyResponse">
        <key-map field-name="surveyResponseId"/>
      </relation>
    </entity>
    <entity entity-name="ShoppingListType"
            package-name="org.apache.ofbiz.order.shoppinglist"
            default-resource-name="OrderEntityLabels"
            title="Shopping List Type">
      <field name="shoppingListTypeId" type="id"></field>
      <field name="description" type="description"></field>
      <prim-key field="shoppingListTypeId"/>
    </entity>
    <entity entity-name="ShoppingListWorkEffort"
        package-name="org.apache.ofbiz.order.shoppinglist"
        title="ShoppingList WorkEffort">
        <field name="shoppingListId" type="id"></field>
        <field name="workEffortId" type="id"></field>
        <prim-key field="shoppingListId"/>
        <prim-key field="workEffortId"/>
        <relation type="one" fk-name="SHLISTWE_SHLST" rel-entity-name="ShoppingList">
            <key-map field-name="shoppingListId"/>
        </relation>
        <relation type="one" fk-name="SHLISTWE_WEFF" rel-entity-name="WorkEffort">
            <key-map field-name="workEffortId"/>
        </relation>
    </entity>

 </entitymodel>
 
