Skip to content

Conversation

@sebalix
Copy link
Member

@sebalix sebalix commented Nov 13, 2024

Not ready to be proposed on OCA, so this PR was open to ease internal reviews.

Based on:

@sebalix sebalix force-pushed the 14.0-stock_average_daily_sale-returns_handling branch 3 times, most recently from 8c90cfc to b088b33 Compare November 14, 2024 08:02
@sebalix sebalix force-pushed the 14.0-stock_average_daily_sale-returns_handling branch from b088b33 to 7bb974d Compare November 22, 2024 15:43
@twalter-c2c twalter-c2c force-pushed the 14.0-stock_average_daily_sale-returns_handling branch 3 times, most recently from f3e6849 to 1c7220a Compare December 9, 2024 12:32
Copy link
Member Author

@sebalix sebalix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@twalter-c2c the new help should be done through a field override in customer specific modules (I guess they have been updated in that regards, not to be proposed to OCA?).

@twalter-c2c twalter-c2c force-pushed the 14.0-stock_average_daily_sale-returns_handling branch from 1c7220a to 03abbfa Compare December 9, 2024 16:33
@twalter-c2c twalter-c2c force-pushed the 14.0-stock_average_daily_sale-returns_handling branch 3 times, most recently from 99e272d to 86935c1 Compare December 11, 2024 14:50
@twalter-c2c twalter-c2c changed the base branch from 14.0-mig-stock_average_daily_sale to 14.0 December 11, 2024 15:33
mymage and others added 7 commits January 16, 2025 15:06
Currently translated at 100.0% (59 of 59 strings)

Translation: stock-logistics-reporting-14.0/stock-logistics-reporting-14.0-stock_average_daily_sale
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-reporting-14-0/stock-logistics-reporting-14-0-stock_average_daily_sale/it/
Currently translated at 16.6% (1 of 6 strings)

Translation: stock-logistics-reporting-14.0/stock-logistics-reporting-14.0-stock_picking_report_custom_description
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-reporting-14-0/stock-logistics-reporting-14-0-stock_picking_report_custom_description/it/
Currently translated at 25.0% (1 of 4 strings)

Translation: stock-logistics-reporting-14.0/stock-logistics-reporting-14.0-stock_account_quantity_history_location
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-reporting-14-0/stock-logistics-reporting-14-0-stock_account_quantity_history_location/it/
Currently translated at 16.6% (1 of 6 strings)

Translation: stock-logistics-reporting-14.0/stock-logistics-reporting-14.0-stock_quant_history_queued
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-reporting-14-0/stock-logistics-reporting-14-0-stock_quant_history_queued/it/
Currently translated at 14.2% (1 of 7 strings)

Translation: stock-logistics-reporting-14.0/stock-logistics-reporting-14.0-delivery_line_sale_line_position
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-reporting-14-0/stock-logistics-reporting-14-0-delivery_line_sale_line_position/it/
Currently translated at 25.0% (1 of 4 strings)

Translation: stock-logistics-reporting-14.0/stock-logistics-reporting-14.0-stock_picking_group_by_partner_by_carrier_sale_line_position
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-reporting-14-0/stock-logistics-reporting-14-0-stock_picking_group_by_partner_by_carrier_sale_line_position/it/
Copy link
Member

@jbaudoux jbaudoux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why hiding such change?

You would have opened a PR on OCA, you would maybe had reviews.

) as recommended_qty
) as recommended_qty,
GREATEST(
(cfg.number_days_qty_in_stock * (average_qty_by_sale - COALESCE(average_qty_by_return, 0)) * (average_daily_sales_count - COALESCE(average_daily_returns_count, 0))) + ((ds.daily_standard_deviation - COALESCE(dsr.daily_standard_deviation, 0)) * cfg.safety_factor * sqrt(nbr_days)),
Copy link
Member

@jbaudoux jbaudoux Mar 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new formula looks wrong to me
If you always ship 10 and you return also 10, then average_qty_by_sale - average_qty_by_return = 0. So a single return will put the recommended qty to 0. That's wrong.
You need to compute the daily sale - the daily return

Suggested change
(cfg.number_days_qty_in_stock * (average_qty_by_sale - COALESCE(average_qty_by_return, 0)) * (average_daily_sales_count - COALESCE(average_daily_returns_count, 0))) + ((ds.daily_standard_deviation - COALESCE(dsr.daily_standard_deviation, 0)) * cfg.safety_factor * sqrt(nbr_days)),
(cfg.number_days_qty_in_stock * (
average_qty_by_sale * average_daily_sales_count
- COALESCE(average_qty_by_return, 0) * COALESCE(average_daily_returns_count, 0)
) + ((ds.daily_standard_deviation - COALESCE(dsr.daily_standard_deviation, 0)) * cfg.safety_factor * sqrt(nbr_days)),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sebalix is the author of these changes, but I also know the topic so I will clarify.
We have 'hidden' the returns handling because the way we handle returns is not universal here. In this case, as returns, we consider moves where sl_src.usage in ('inventory') AND sl_dest.usage in ('internal') which is rather a custom requirement.
The changes you requested are still relevant in my opinion though. Thank you for the suggestion, I will fix that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @twalter-c2c
I'm still clarifying the formula with Meredith

@twalter-c2c twalter-c2c force-pushed the 14.0-stock_average_daily_sale-returns_handling branch from 9eea93a to 5d42c8d Compare March 19, 2025 11:19
twalter-c2c and others added 4 commits March 19, 2025 12:31
Take returns into account while calculating average daily sale usage.

In our specific case, returns mean stock moves from the 'Inventory adjustment'
location to the physical stock location (of usage 'internal').

Co-Authored-By: Sébastien Alix <[email protected]>
@twalter-c2c twalter-c2c force-pushed the 14.0-stock_average_daily_sale-returns_handling branch from 5d42c8d to 3c309ed Compare March 19, 2025 11:31
@twalter-c2c twalter-c2c force-pushed the 14.0-stock_average_daily_sale-returns_handling branch from 3c309ed to 14507cf Compare March 19, 2025 11:54
Copy link

@florentx florentx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG, but I did not dig into algorithm itself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants