Erroneous Cumulative quantity in stock moves by warehouse

Hi,

We noticed something strange in the view Stock Moves By Warehouse: the cumulative quantity start is not decremented correctly. I tried to reproduce on the demo but it’s working.

Here’s our screenshot:

The cumulative quantity start on the fourth line is the same as the first line (instead of 70.898.789, it should be 52.898.789). The same problem happens on the 10th line. First moves are draft outgoing moves (customer shipment).

Thanks for help.

It looks like cumulative_quantity_start is off by one date.

As you say they are due to draft move, normally draft moves in the past should not be included.

Indeed, it’s a problem we had last week. (so draft moves were not in the past).
We made a dump of the database and to reproduce the problem, i’ve set today date (for this view) in the past.

I noticed start_date and end_date are the same. Could be the problem ?

How did you do that? I suspect this is not done everywhere.

I’ve just set 'today = datetime.date(2024, 7, 16) in the method def table_query https://foss.heptapod.net/tryton/tryton/-/blob/branch/default/modules/stock/product.py#L925

It was the only way to see the problem happened last week.

Here’s the screenshot of the last week:

This is not enough as the Product.products_by_location relies also on a today to compute the quantities.
So you should modify the Date.today at least.

What was the day?

Ok, i’ll retry this way.

16/07/2024

I’ve set Date.today to 16/07/2024 as you suggest. Now, I’ve the same result as last week:

As I could see in my example, in the list of the stock moves, the fourth line (PACK-002076) is an assigned move.

But, to calculate Cumulative Quantity Start with Product_by_location, quantity of assigned move is not counted. So in my example, the delta between the dates ‘18/07/2024’ and ‘25/09/2024’ is -30.000.000 and should be -36.000.000 if all moves were concerned.

So assigned moves with a planned date < today are displayed but are not counted in the stock quantities to calculate the cumulative quantity start.

Indeed the date for such move should be today like it is done in Move.compute_quantities_query.
Please fill an issue.

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.