Skip to content

[14.0][IMP] stock_location_last_inventory_date: propagate data on empty loc…#2519

Open
devRaumschmiede wants to merge 4 commits intoOCA:14.0from
devRaumschmiede:14_stock_location_last_inventory_date
Open

[14.0][IMP] stock_location_last_inventory_date: propagate data on empty loc…#2519
devRaumschmiede wants to merge 4 commits intoOCA:14.0from
devRaumschmiede:14_stock_location_last_inventory_date

Conversation

@devRaumschmiede
Copy link
Copy Markdown

…ation

when inventory has no products, or no differences at the location is added the inventory data is not set on location

…ation

when inventory has no products, or no differences at the location
is added the inventory data is not set on location
@dreispt dreispt changed the title [IMP] stock_location_last_inventory_date: propagate data on empty loc… [14.0][IMP] stock_location_last_inventory_date: propagate data on empty loc… Feb 12, 2026
@mt-software-de
Copy link
Copy Markdown
Contributor

Since it was changed to a stored filed within #2222
It didn't behaved as before, because only locations are used which are used in a inventory line.
By adding all locations (+ their children) configured on an inventory it would be fixed.

cc @jbaudoux

Copy link
Copy Markdown
Contributor

@mt-software-de mt-software-de left a comment

Choose a reason for hiding this comment

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

Thx. LGTM

Copy link
Copy Markdown
Contributor

@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.

So if you have a quant on Stock and want to remove it with an inventory, you will update the last inventory date of all locations under Stock. That doesn't look right to me.

@mt-software-de
Copy link
Copy Markdown
Contributor

So if you have a quant on Stock and want to remove it with an inventory, you will update the last inventory date of all locations under Stock. That doesn't look right to me.

But then you wouldn't create an inventory adjustment for Stock. Because this will create inventory lines for all quants on stock and its children. You would need to delete a lot of lines if you simply want to remove just one quant.

@jbaudoux
Copy link
Copy Markdown
Contributor

So if you have a quant on Stock and want to remove it with an inventory, you will update the last inventory date of all locations under Stock. That doesn't look right to me.

But then you wouldn't create an inventory adjustment for Stock. Because this will create inventory lines for all quants on stock and its children. You would need to delete a lot of lines if you simply want to remove just one quant.

My point is that inventory lines are telling which locations are inventoried. You can add lines or remove lines. The location in the inventory is in my opinion only a helper to preload lines.

@mt-software-de
Copy link
Copy Markdown
Contributor

mt-software-de commented Feb 15, 2026

So if you have a quant on Stock and want to remove it with an inventory, you will update the last inventory date of all locations under Stock. That doesn't look right to me.

But then you wouldn't create an inventory adjustment for Stock. Because this will create inventory lines for all quants on stock and its children. You would need to delete a lot of lines if you simply want to remove just one quant.

My point is that inventory lines are telling which locations are inventoried. You can add lines or remove lines. The location in the inventory is in my opinion only a helper to preload lines.

Yes i understand your point. But in fact for empty Locations before and after the inventory it will be then never set. Also If you checking the Code before my change it was exaclty computed as it would be with this PR.

We could add new field in the inventory adjustment which inticates If preloaded lines we're removed. If the field indicates that nothing was removed. Then set the date as it is done here otherwise set it only on Locations which are listed in the lines. @jbaudoux what do you think?

Co-authored-by: Michael Tietz <78783475+mt-software-de@users.noreply.github.com>
@mt-software-de
Copy link
Copy Markdown
Contributor

So if you have a quant on Stock and want to remove it with an inventory, you will update the last inventory date of all locations under Stock. That doesn't look right to me.

But then you wouldn't create an inventory adjustment for Stock. Because this will create inventory lines for all quants on stock and its children. You would need to delete a lot of lines if you simply want to remove just one quant.

My point is that inventory lines are telling which locations are inventoried. You can add lines or remove lines. The location in the inventory is in my opinion only a helper to preload lines.

Yes i understand your point. But in fact for empty Locations before and after the inventory it will be then never set. Also If you checking the Code before my change it was exaclty computed as it would be with this PR.

We could add new field in the inventory adjustment which inticates If preloaded lines we're removed. If the field indicates that nothing was removed. Then set the date as it is done here otherwise set it only on Locations which are listed in the lines. @jbaudoux what do you think?

ping @jbaudoux

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please update the post_init_hook and use it then here.

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.

6 participants