Skip to content
Snippets Groups Projects
Commit d64ce530 authored by Nicolas Martinelli's avatar Nicolas Martinelli Committed by Nicolas Martinelli
Browse files

[FIX] stock_calendar: scheduled data

- Install stock_calendar
- Create a stockable product
- Add the route "Buy"
- Add a vendor with a delivery lead time of 30 days
- Create a reordering rule for x units
- Run the schedulers

A PO is created, but the scheduled date is set as today, not today + 30
days.

What happens is the following:
1. Since no `calendar_id` is defined on the orderpoint, `_get_group`
   returns `[(now, None)]`
2. `now` is used in the `procurement_values` of the `res_groups` by
   `_procurement_from_orderpoint_get_groups`
3. The `res_groups` values are used in `_procure_orderpoint_confirm`
   when calling `_prepare_procurement_values`.
4. `_prepare_procurement_values` is overridden by `stock_calendar` to
   set a value for `next_delivery_date`. At this point, the `now` value
   is used.
5. Finally, when creating the PO line, `_prepare_purchase_order_line` is
   overridden by `stock_calendar` to set the `next_delivery_date` as
   `date_planned`.

So, `date_planned` becomes `now`.

There should not be any date set when no `calendar_id` is defined.

opw-1828371
parent 77bf2c96
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment