Skip to content
Snippets Groups Projects
Commit 0a1f1464 authored by Touati Djamel (otd)'s avatar Touati Djamel (otd)
Browse files

[FIX] stock:use manufacture security LT if manufacture is selected in RR


Steps to reproduce the bug:
- Assume the current date is August 1, 2023.
- Go to general settings:
    - set purchase security lead time: 20 days
    - set manufacturing security lead time: 25 days

- Create a storable product “P1”
    - Routes: Manufacture + buy
    - Manufacture lead time: 1 day

- Create an order point:
   - preferred route: Manufacture
   - Quantity to order: 5
   - Click on “Order once”

Problem:
A manufacturing order is created, but the "Scheduled Date" is incorrect.
Instead of being set to August 1, 2023, it shows August 7th.

The issue occurs because initially, we calculate the `Lead days date`
as follows:
Today's date (August 1st) + manufacturing security lead time (25)
+ Manufacturing Lead Time (1) = August 27th.
However, we use the purchase security lead time (20) instead of the
manufacturing so 27 - 20 = August 7th

To determine the exact date, we call the function
`_get_date_with_security_lead_days`. In which we try to get the
appropriate rule to use. However, in this case, the preferred route
of the orderpoint is not passed as a parameter to the function.
Therefore, we use the first rule of the first route ("buy"), and we end
up using its security lead time.

opw-3439546

closes odoo/odoo#130431

Signed-off-by: default avatarArnold Moyaux (arm) <arm@odoo.com>
parent 768b1755
No related branches found
No related tags found
No related merge requests found
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