You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Jacopo Cappellato <ti...@sastau.it> on 2006/12/05 08:25:41 UTC

Rewriting the OrderItemAssociation entity

Hi,

I really think we should refactor the OrderItemAssociation entity, in 
order to make it more generic.

Right now the entity has the following fields:

<field name="salesOrderId" type="id-ne"/>
<field name="soItemSeqId" type="id-ne"/>
<field name="purchaseOrderId" type="id-ne"/>
<field name="poItemSeqId" type="id-ne"/>

I think that we should at least modify them in this way:

<field name="orderId" type="id-ne"/>
<field name="orderItemSeqId" type="id-ne"/>
<field name="orderIdTo" type="id-ne"/>
<field name="orderItemSeqIdTo" type="id-ne"/>
<field name="orderItemAssocTypeId" type="id-ne"/>

We should also rename it to "OrderItemAssoc" and create the new entity 
"OrderItemAssocType".
In this way we could link not just a sales order to a purchase order, 
but also two sales orders together (for example a replacement order).

I think we should also add the ability to associate sub-item quantities, 
maybe adding an OrderItemAssoc.quantity field and adding two 
OrderItemAssoc.shipGroupSeqId and OrderItemAssoc.shipGroupSeqIdTo.

So the final entity should look like:

OrderItemAssoc
<field name="orderId" type="id-ne"/> PK
<field name="orderItemSeqId" type="id-ne"/> PK
<field name="shipGroupSeqId" type="id-ne"/> PK
<field name="orderIdTo" type="id-ne"/> PK
<field name="orderItemSeqIdTo" type="id-ne"/> PK
<field name="shipGroupSeqIdTo" type="id-ne"/> PK
<field name="orderItemAssocTypeId" type="id-ne"/> PK
<field name="quantity" type="floating-point"/>

Does it make sense?
If it's ok for all of you, I could take care of this migration since I'm 
working on the return of type "replacement" and on drop shipments and 
I'll need some of this features soon.

Jacopo


Re: Rewriting the OrderItemAssociation entity

Posted by David E Jones <jo...@undersunconsulting.com>.
The restructuring of the entity to make it more flexible sounds fine.

The first question though would whether or not anyone is using this.  
If so it's a bit of a pain because data migration is needed for the  
update.

The pattern for this sort of update would be:

1. change the entity name from OrderItemAssociation to  
OldOrderItemAssociation
2. set the table name on the entity to ORDER_ITEM_ASSOCIATION
3. create a service to move data from the OldOrderItemAssociation  
entity to the new OrderItemAssoc entity

-David


On Dec 5, 2006, at 12:25 AM, Jacopo Cappellato wrote:

> Hi,
>
> I really think we should refactor the OrderItemAssociation entity,  
> in order to make it more generic.
>
> Right now the entity has the following fields:
>
> <field name="salesOrderId" type="id-ne"/>
> <field name="soItemSeqId" type="id-ne"/>
> <field name="purchaseOrderId" type="id-ne"/>
> <field name="poItemSeqId" type="id-ne"/>
>
> I think that we should at least modify them in this way:
>
> <field name="orderId" type="id-ne"/>
> <field name="orderItemSeqId" type="id-ne"/>
> <field name="orderIdTo" type="id-ne"/>
> <field name="orderItemSeqIdTo" type="id-ne"/>
> <field name="orderItemAssocTypeId" type="id-ne"/>
>
> We should also rename it to "OrderItemAssoc" and create the new  
> entity "OrderItemAssocType".
> In this way we could link not just a sales order to a purchase  
> order, but also two sales orders together (for example a  
> replacement order).
>
> I think we should also add the ability to associate sub-item  
> quantities, maybe adding an OrderItemAssoc.quantity field and  
> adding two OrderItemAssoc.shipGroupSeqId and  
> OrderItemAssoc.shipGroupSeqIdTo.
>
> So the final entity should look like:
>
> OrderItemAssoc
> <field name="orderId" type="id-ne"/> PK
> <field name="orderItemSeqId" type="id-ne"/> PK
> <field name="shipGroupSeqId" type="id-ne"/> PK
> <field name="orderIdTo" type="id-ne"/> PK
> <field name="orderItemSeqIdTo" type="id-ne"/> PK
> <field name="shipGroupSeqIdTo" type="id-ne"/> PK
> <field name="orderItemAssocTypeId" type="id-ne"/> PK
> <field name="quantity" type="floating-point"/>
>
> Does it make sense?
> If it's ok for all of you, I could take care of this migration  
> since I'm working on the return of type "replacement" and on drop  
> shipments and I'll need some of this features soon.
>
> Jacopo
>