Where to store the reason for canceling some quantity of Order Item

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Where to store the reason for canceling some quantity of Order Item

Bilgin Ibryam
Hi all,

I am working on order manager and canceling order items.
There is already a possibility to cancel some quantity of order Items
which updates cancelQunatity of orderItem w/o canceling the whole
orderItem.
What I need is to store the cancelReasonId (Enumeration or a new entity
for cancel Reasons) and comments for this cancel. Notice that this
doesn't change the orderItem status, because only a quantity from the
item is canceled.
Order Notes are not appropriate, because I need to know which orderItem
is canceled, and also need to store cancelReasonId for creating
statistics based on cancel reasons.

Do you think that we need a new entity in OFBiz for this or it is
possible somehow with existing entities?

Any thoughts or advices would be greatly appreciated.
Bilgin Ibryam

Reply | Threaded
Open this post in threaded view
|

Re: Where to store the reason for canceling some quantity of Order Item

Jacopo Cappellato-3
Hi Bilgin,

we may implement this using one of the following approaches:

A) extending order notes (a bit hacky):

A1) rename OrderHeaderNote to OrderNote and add to it an  
orderItemSeqId that can be set to "_NA_" for order header notes
A2) store the cancellation reason as an note (you may pre-define all  
the noteId available in a drop down)

or

B) add a new entity "OrderItemChange" that keeps track of all the  
modifications of an OrderItem (including cancellation); the new entity  
may have a type and a reasonEnumId

There are probably other solutions... these are the first ones that  
comes to my mind

My two cents,

Jacopo


On May 7, 2008, at 11:36 AM, Bilgin Ibryam wrote:

> Hi all,
>
> I am working on order manager and canceling order items.
> There is already a possibility to cancel some quantity of order Items
> which updates cancelQunatity of orderItem w/o canceling the whole
> orderItem.
> What I need is to store the cancelReasonId (Enumeration or a new  
> entity
> for cancel Reasons) and comments for this cancel. Notice that this
> doesn't change the orderItem status, because only a quantity from the
> item is canceled.
> Order Notes are not appropriate, because I need to know which  
> orderItem
> is canceled, and also need to store cancelReasonId for creating
> statistics based on cancel reasons.
>
> Do you think that we need a new entity in OFBiz for this or it is
> possible somehow with existing entities?
>
> Any thoughts or advices would be greatly appreciated.
> Bilgin Ibryam
>

Reply | Threaded
Open this post in threaded view
|

Re: Where to store the reason for canceling some quantity of Order Item

Bilgin Ibryam
Jacopo, thanks for the suggestions.

As you said using OrderHeaderNote is a bit hacky solution, but extending
OrderHeaderNote enity the way you suggested would allow us adding order
notes per order item. May be I can extend it later.

I think using "OrderItemChange" entity is a better way to go.
Do you mean something like this:

    <entity entity-name="OrderItemChange"
            package-name="org.ofbiz.order.order"
            never-cache="true"
            title="Order Item Change Entity">
      <field name="orderItemChangeId" type="id-ne"></field>
      <field name="orderItemChangeTypeId" type="id-ne"></field>      
      <field name="orderId" type="id-ne"></field>
      <field name="orderItemSeqId" type="id-ne"></field>
      <field name="reasonEnumId" type="id"></field>
      <field name="comments" type="comment"></field>      
      <prim-key field="orderItemChangeId"/>
      <relation type="one" fk-name="ORDER_ITCH_TYPE"
rel-entity-name="OrderItemChangeType">
        <key-map field-name="orderItemChangeTypeId"/>
      </relation>      
      <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_REAS" title="Reason"
rel-entity-name="Enumeration">
          <key-map field-name="reasonEnumId" rel-field-name="enumId"/>
      </relation>
    </entity>
    <entity entity-name="OrderItemChangeType"
            package-name="org.ofbiz.order.order"
            title="Order Item Change Type Entity">
      <field name="orderItemChangeTypeId" type="id-ne"></field>
      <field name="hasTable" type="indicator"></field>
      <field name="description" type="description"></field>
      <prim-key field="orderItemChangeTypeId"/>
    </entity>

What do you think about these entities? Should I commit them? Any other
solutions?

Thanks in advance
Bilgin

Reply | Threaded
Open this post in threaded view
|

Re: Where to store the reason for canceling some quantity of Order Item

Jacopo Cappellato-3
Bilgin,

it looks like a good start but I would like to get some feedback from  
others too.
Also, it would be a good idea to add fields to store the quantity,  
cancelled units, unit price so that we can keep a record if they are  
changed: the fields will be populated only if the data in the  
OrderItem is changed.

Jacopo

On May 7, 2008, at 5:54 PM, Bilgin Ibryam wrote:

> Jacopo, thanks for the suggestions.
>
> As you said using OrderHeaderNote is a bit hacky solution, but  
> extending
> OrderHeaderNote enity the way you suggested would allow us adding  
> order
> notes per order item. May be I can extend it later.
>
> I think using "OrderItemChange" entity is a better way to go.
> Do you mean something like this:
>
>    <entity entity-name="OrderItemChange"
>            package-name="org.ofbiz.order.order"
>            never-cache="true"
>            title="Order Item Change Entity">
>      <field name="orderItemChangeId" type="id-ne"></field>
>      <field name="orderItemChangeTypeId" type="id-ne"></field>
>      <field name="orderId" type="id-ne"></field>
>      <field name="orderItemSeqId" type="id-ne"></field>
>      <field name="reasonEnumId" type="id"></field>
>      <field name="comments" type="comment"></field>
>      <prim-key field="orderItemChangeId"/>
>      <relation type="one" fk-name="ORDER_ITCH_TYPE"
> rel-entity-name="OrderItemChangeType">
>        <key-map field-name="orderItemChangeTypeId"/>
>      </relation>
>      <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_REAS" title="Reason"
> rel-entity-name="Enumeration">
>          <key-map field-name="reasonEnumId" rel-field-name="enumId"/>
>      </relation>
>    </entity>
>    <entity entity-name="OrderItemChangeType"
>            package-name="org.ofbiz.order.order"
>            title="Order Item Change Type Entity">
>      <field name="orderItemChangeTypeId" type="id-ne"></field>
>      <field name="hasTable" type="indicator"></field>
>      <field name="description" type="description"></field>
>      <prim-key field="orderItemChangeTypeId"/>
>    </entity>
>
> What do you think about these entities? Should I commit them? Any  
> other
> solutions?
>
> Thanks in advance
> Bilgin
>

Reply | Threaded
Open this post in threaded view
|

Re: Where to store the reason for canceling some quantity of Order Item

Bilgin Ibryam
Jacopo,

I followed your suggestions and created an issue with patch OFBIZ-1773
Thanks for your guidance.

Yes, it would be nice to get some feedback from others too.
Reply | Threaded
Open this post in threaded view
|

Re: Where to store the reason for canceling some quantity of Order Item

Jacques Le Roux
Administrator
In reply to this post by Jacopo Cappellato-3
Looks good, +1 for changes history

BTW this should have better been in dev ML ;o)

Jacques

From: "Jacopo Cappellato" <[hidden email]>

> Bilgin,
>
> it looks like a good start but I would like to get some feedback from  
> others too.
> Also, it would be a good idea to add fields to store the quantity,  
> cancelled units, unit price so that we can keep a record if they are  
> changed: the fields will be populated only if the data in the  
> OrderItem is changed.
>
> Jacopo
>
> On May 7, 2008, at 5:54 PM, Bilgin Ibryam wrote:
>
>> Jacopo, thanks for the suggestions.
>>
>> As you said using OrderHeaderNote is a bit hacky solution, but  
>> extending
>> OrderHeaderNote enity the way you suggested would allow us adding  
>> order
>> notes per order item. May be I can extend it later.
>>
>> I think using "OrderItemChange" entity is a better way to go.
>> Do you mean something like this:
>>
>>    <entity entity-name="OrderItemChange"
>>            package-name="org.ofbiz.order.order"
>>            never-cache="true"
>>            title="Order Item Change Entity">
>>      <field name="orderItemChangeId" type="id-ne"></field>
>>      <field name="orderItemChangeTypeId" type="id-ne"></field>
>>      <field name="orderId" type="id-ne"></field>
>>      <field name="orderItemSeqId" type="id-ne"></field>
>>      <field name="reasonEnumId" type="id"></field>
>>      <field name="comments" type="comment"></field>
>>      <prim-key field="orderItemChangeId"/>
>>      <relation type="one" fk-name="ORDER_ITCH_TYPE"
>> rel-entity-name="OrderItemChangeType">
>>        <key-map field-name="orderItemChangeTypeId"/>
>>      </relation>
>>      <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_REAS" title="Reason"
>> rel-entity-name="Enumeration">
>>          <key-map field-name="reasonEnumId" rel-field-name="enumId"/>
>>      </relation>
>>    </entity>
>>    <entity entity-name="OrderItemChangeType"
>>            package-name="org.ofbiz.order.order"
>>            title="Order Item Change Type Entity">
>>      <field name="orderItemChangeTypeId" type="id-ne"></field>
>>      <field name="hasTable" type="indicator"></field>
>>      <field name="description" type="description"></field>
>>      <prim-key field="orderItemChangeTypeId"/>
>>    </entity>
>>
>> What do you think about these entities? Should I commit them? Any  
>> other
>> solutions?
>>
>> Thanks in advance
>> Bilgin
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Where to store the reason for canceling some quantity of Order Item

Jacques Le Roux
Administrator
In reply to this post by Bilgin Ibryam
Looks good, +1 for changes history. I added some comments in the Jira issue

BTW this should have better been in dev ML ;o)

Jacques

From: "Bilgin Ibryam" <[hidden email]>

>
> Jacopo,
>
> I followed your suggestions and created an issue with patch OFBIZ-1773
> Thanks for your guidance.
>
> Yes, it would be nice to get some feedback from others too.
> --
> View this message in context:
> http://www.nabble.com/Where-to-store-the-reason-for-canceling-some-quantity-of-Order-Item-tp17101121p17138856.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>