-
Notifications
You must be signed in to change notification settings - Fork 0
[14.0] stock_average_daily_sale: returns handling #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 14.0
Are you sure you want to change the base?
Conversation
8c90cfc to
b088b33
Compare
b088b33 to
7bb974d
Compare
f3e6849 to
1c7220a
Compare
sebalix
left a comment
There was a problem hiding this 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?).
1c7220a to
03abbfa
Compare
99e272d to
86935c1
Compare
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/
jbaudoux
left a comment
There was a problem hiding this 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)), |
There was a problem hiding this comment.
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
| (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)), |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
9eea93a to
5d42c8d
Compare
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]>
5d42c8d to
3c309ed
Compare
3c309ed to
14507cf
Compare
florentx
left a comment
There was a problem hiding this 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
Not ready to be proposed on OCA, so this PR was open to ease internal reviews.
Based on: