Tryton - Issues

 

Issue8703

Title stock_forecast creates moves in the past
Priority bug Status testing
Superseder Nosy List albertca, ced, reviewbot
Type behavior Components stock_supply_forecast
Assigned To albertca Keywords review
Reviews 272251002
View: 272251002

Created on 2019-10-03.00:55:32 by albertca, last changed by reviewbot.

Messages
review272251002 updated at https://codereview.tryton.org/272251002/#ps260301002
msg52404 (view) Author: [hidden] (albertca) (Tryton committer) Date: 2019-10-11.00:24:28
Missatge de Cédric Krier <bugs@tryton.org> del dia dj., 10 d’oct. 2019
a les 23:44:
>
>
> Cédric Krier <cedric.krier@b2ck.com> added the comment:
>
> Do you plan to finish the patch?

I plan to do it but don't have a date. Feel free to pick the patch if
you want to.
msg52394 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-10-10.23:44:52
Do you plan to finish the patch?
msg52275 (view) Author: [hidden] (albertca) (Tryton committer) Date: 2019-10-03.17:39:53
For me the right behaviour is the one I propose because we already substract the quantity executed. See:

http://hg.tryton.org/modules/stock_forecast/file/tip/forecast.py#l441
msg52270 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-10-03.14:18:49
OK so for me, the correct behavior is to always spread the same quantity no matter the current date. So for your example, it should keep spreading 1 unit per day in all cases.
AN optimization is possible by not creating move in the past.
msg52269 (view) Author: [hidden] (albertca) (Tryton committer) Date: 2019-10-03.13:40:43
Missatge de Cédric Krier <bugs@tryton.org> del dia dj., 3 d’oct. 2019 a les
9:31:

>
> Cédric Krier <cedric.krier@b2ck.com> added the comment:
>
> I do not see the problem. The forecast is smoothly distributed on a date
> range.
>

Yes but the date range used for computing the distribution is:

delta = from_date - to_date

*but* later the date used for creating the moves starts at:

self.forecast.from_date

So, say the user created a forecast between Sept 1st - 30th of 30 units
(with minimum of 1 unit). Suppose no products where actually consumed yet
and today is September 21th.

The current computation would spread 30 units among 10 days (that is 3
units a day). But it would start spreading starting on September 1st
instead of Sept 21th.
msg52265 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-10-03.09:31:17
I do not see the problem. The forecast is smoothly distributed on a date range.
review272251002 updated at https://codereview.tryton.org/272251002/#ps268061002
msg52263 (view) Author: [hidden] (albertca) (Tryton committer) Date: 2019-10-03.00:55:31
While working on issue8702 I realized that stock_forecast's create_moves() creates moves in the past.
History
Date User Action Args
2019-10-11 00:43:17reviewbotsetmessages: + msg52405
2019-10-11 00:24:28albertcasetmessages: + msg52404
2019-10-10 23:44:52cedsetmessages: + msg52394
2019-10-03 17:39:53albertcasetmessages: + msg52275
2019-10-03 14:18:49cedsetmessages: + msg52270
2019-10-03 13:40:44albertcasetmessages: + msg52269
2019-10-03 09:31:18cedsetnosy: + ced
messages: + msg52265
2019-10-03 01:18:41pokolisetstatus: chatting -> testing
component: + stock_supply_forecast
type: behavior
2019-10-03 01:07:37reviewbotsetstatus: unread -> chatting
nosy: + reviewbot
messages: + msg52264
2019-10-03 00:57:08albertcasetreviews: 272251002
keyword: + review

Showing 10 items. Show all history (warning: this could be VERY long)