On Mar 17, 2010, at 8:03 PM, Adam Heath wrote:

> jaco...@apache.org wrote:
>> Author: jacopoc
>> Date: Sat Jan  2 18:20:19 2010
>> New Revision: 895250
>> 
>> URL: http://svn.apache.org/viewvc?rev=895250&view=rev
>> Log:
>> Pretty important change in the way purchase shipments and 
>> purchase-order-to-shipment mapping are modeled:
>> * OrderShipment entity (that was mostly unused) has been enhanced to 
>> properly associate order items (OrderItemShipGrpAssoc) to shipment items: 
>> this entity is now used in place of ItemIssuance (that was improperly used, 
>> in po, for the same purpose)
>> * as a consequence of the above change, I have updated the purchase order 
>> receive screens and business logic triggered by them
>> 
>> Modified:
>>    ofbiz/trunk/applications/order/entitydef/entitymodel.xml
>>    ofbiz/trunk/applications/product/entitydef/entitymodel_shipment.xml
>>    
>> ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml
>>    
>> ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml
>>    
>> ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml
>>    ofbiz/trunk/applications/product/servicedef/services_shipment.xml
>>    
>> ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/ReceiveInventory.groovy
>>    
>> ofbiz/trunk/applications/product/webapp/facility/inventory/receiveInventory.ftl
>>    
>> ofbiz/trunk/applications/product/webapp/facility/shipment/ShipmentTabBar.ftl
>>    ofbiz/trunk/applications/product/widget/facility/ShipmentForms.xml
>>    ofbiz/trunk/applications/product/widget/facility/ShipmentScreens.xml
>> 
>> Modified: ofbiz/trunk/applications/order/entitydef/entitymodel.xml
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/entitydef/entitymodel.xml?rev=895250&r1=895249&r2=895250&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/applications/order/entitydef/entitymodel.xml (original)
>> +++ ofbiz/trunk/applications/order/entitydef/entitymodel.xml Sat Jan  2 
>> 18:20:19 2010
>> @@ -1131,11 +1131,13 @@
>>             title="Order Shipment Entity">
>>       <field name="orderId" type="id-ne"></field>
>>       <field name="orderItemSeqId" type="id-ne"></field>
>> +      <field name="shipGroupSeqId" type="id-ne"></field>
>>       <field name="shipmentId" type="id-ne"></field>
>>       <field name="shipmentItemSeqId" type="id-ne"></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">
>> @@ -1152,6 +1154,11 @@
>>         <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.ofbiz.order.order"
>> 
> 
> No, NO NO!.
> 
> Do not change the primary key of entities.  Period.  There are
> procedures for doing this, deprecating the old, making a new.  This
> broke my code.
> 

See if this can help you:

Kind regards,

Jacopo




Author: jacopoc
Date: Mon Jan 11 15:19:03 2010
New Revision: 897897

URL: http://svn.apache.org/viewvc?rev=897897&view=rev
Log:
Implemented upgrade service for ItemIssuance->OrderShipment record migration 
for purchase shipments.


Modified:
   ofbiz/trunk/applications/order/script/org/ofbiz/order/UpgradeServices.xml
   ofbiz/trunk/applications/order/servicedef/services_upgrade.xml

Modified: 
ofbiz/trunk/applications/order/script/org/ofbiz/order/UpgradeServices.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/UpgradeServices.xml?rev=897897&r1=897896&r2=897897&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/script/org/ofbiz/order/UpgradeServices.xml 
(original)
+++ ofbiz/trunk/applications/order/script/org/ofbiz/order/UpgradeServices.xml 
Mon Jan 11 15:19:03 2010
@@ -48,5 +48,29 @@
            <create-value value-field="custRequestParty"/>
        </iterate>
    </simple-method>
-</simple-methods>

+    <simple-method method-name="migrateOrderShipment" 
short-description="Migrate data from OldOrderItemAssociation to OrderItemAssoc">
+        <entity-condition entity-name="ItemIssuance" list="itemIssuances">
+            <condition-list combine="and">
+                <condition-expr field-name="inventoryItemId" operator="equals" 
from-field="nullField"/>
+                <condition-expr field-name="shipmentId" operator="not-equals" 
from-field="nullField"/>
+                <condition-expr field-name="shipmentItemSeqId" 
operator="not-equals" from-field="nullField"/>
+            </condition-list>
+        </entity-condition>
+        <iterate list="itemIssuances" entry="itemIssuance">
+            <make-value entity-name="OrderShipment" 
value-field="orderShipment"/>
+            <set field="orderShipment.orderId" 
from-field="itemIssuance.orderId"/>
+            <set field="orderShipment.orderItemSeqId" 
from-field="itemIssuance.orderItemSeqId"/>
+            <set field="orderShipment.shipGroupSeqId" 
from-field="itemIssuance.shipGroupSeqId"/>
+            <set field="orderShipment.shipmentId" 
from-field="itemIssuance.shipmentId"/>
+            <set field="orderShipment.shipmentItemSeqId" 
from-field="itemIssuance.shipmentItemSeqId"/>
+            <set field="orderShipment.quantity" 
from-field="itemIssuance.quantity"/>
+            <create-value value-field="orderShipment"/>
+            <get-related value-field="itemIssuance" 
relation-name="ItemIssuanceRole" list="itemIssuanceRoles"/>
+            <iterate entry="itemIssuanceRole" list="itemIssuanceRoles">
+                <remove-value value-field="itemIssuanceRole"/>
+            </iterate>
+            <remove-value value-field="itemIssuance"/>
+        </iterate>
+    </simple-method>
+</simple-methods>

Modified: ofbiz/trunk/applications/order/servicedef/services_upgrade.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services_upgrade.xml?rev=897897&r1=897896&r2=897897&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/services_upgrade.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/services_upgrade.xml Mon Jan 11 
15:19:03 2010
@@ -45,4 +45,12 @@
            party/data/PartyTypeData.xml
        </description>
    </service>
+    <service name="migrateOrderShipment" engine="simple"
+            
location="component://order/script/org/ofbiz/order/UpgradeServices.xml" 
invoke="migrateOrderShipment">
+        <description>
+            Since revision 895250 (2010-01-02) the entity OrderShipment is 
used to record purchase order items that
+            will be received as part of a purchase shipment. Previously 
ItemIssuance was used with an empty inventoryId.
+            This service will replace ItemIssuaces with OrderShipment records 
for the required shipments.
+        </description>
+    </service>
</services>


Reply via email to