Skip to Content
Menu
This question has been flagged
3 Replies
6714 Views

I know this has been asked before, but I need some additional clarification on how Odoo will handle stock reservation when orders have future delivery dates and any best practices y'all have for managing them.

I found a similar question on the forum, for which the solution was to turn on the automatic scheduler.  However, in that example, there were zero units on hand, and receiving quantity to stock is what triggered the stock reservation by delivery date.  I'm wondering if I can trigger that recalculation of reserved quantities, without having to receive stock.  I have run the scheduler manually, but it did not redo the reservations as I hoped.

Here is my example:

Inventory Configuration for stock reservation is set to:  Manually or based on automatic scheduler

I have 100 units of my product in stock. 

If I enter and confirm the following sales orders today I want Odoo to reserve quantity for the orders with the earliest delivery dates first.  I want the scheduler to replan (redo the reservations) whenever I confirm a new order.

SO#1 - 60 Units, delivery date 12/31/2020

            -  Odoo reserved 60 units for this order

            - as long as this is the only confirmed order, that's fine


SO#2 - 60 Units, delivery date today, 6/25/2020

            - Odoo reserved 40 units for this order

            -  (100 on hand, 60 reserved for SO#1, so this one gets 40 units reserved.)

            -  what I really want is for Odoo to look at the delivery date and reserve 60 units for this order, and replan the reservation for SO#1, reserving the remaining 40 units for SO#1.


SO#3 - 35 Units, delivery date tomorrow, 6/26/2020

            -  Odoo didn't reserve anything for this order, because all 100 units were reserved for SO#1 and SO#2.

            -  I want  Odoo to replan again and reserve quantity for SO#2 then SO#3 before it reserves quantity for SO#1, because the delivery dates are sooner.


 Here are my questions:

    -  Am I correct to understand that once a quantity is reserved, Odoo will not replan the reservation until I receive more quantity?

    - If that is not correct, what am I doing wrong?

    -  If I do have to receive quantity to trigger the replanning of reserved orders, does anyone have tips on how to manage reservations for future shipments.  I have some ideas but they aren't ideal.  I'd appreciate any advice y'all have.

    - Are there any Apps that might solve this issue?


I appreciate any insight!

Avatar
Discard
Best Answer

Hi Shelley:

The following customization to the server action that runs the auto scheduler will allow you to do this. The customization leverages Odoo's built in function that allows the user to manually "unreserve" a delivery order. The custom code introduces a step that automatically "unreserve"s the currently reserved delivery orders before proceeding with the auto scheduling. The outcome is what you are looking for i.e. rescheduling the deliveries based on the delivery date when new orders are confirmed.

NOTE: You should try it out in a development instance and test it thoroughly to make sure there are no unintended side effects.


Code to be added to the server action Procurement: run scheduler.

# Unreserve Delivery Orders that are currently reserved
for rec in env['stock.picking'].search([('picking_type_id.name', '=', 'Delivery Orders'), ('state', '=', 'assigned')]):
  rec.do_unreserve()

Avatar
Discard
Author Best Answer

Thank you Paresh!  This helped a lot.  As I started testing I got worried that unreserving everything might be an issue for our high volume clients.  Expanding on your idea we created a server action to allow users to unreserve selected items.  Clients will have to manually run the scheduler after unreserving, but I think they will like having that control.  Thank you again for your help; it was exactly what we needed.


# Unreserve Selected Delivery Orders
for rec in records:
  rec.do_unreserve()

Avatar
Discard
Best Answer

We unreserve everything that isn't prioritized every night. But we have to do it in chunks because there is just soooo many orders in house. I have an scheduled action that runs 15 times a night. Then I have another scheduled action that reschedules the first one for the next night. A lot of future ship orders waiting on inventory to arrive from China.

Avatar
Discard