Skip to content
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

[FR] Update date in "updated" field on stock allocation #5630

Closed
1 of 2 tasks
StormTrooper opened this issue Sep 28, 2023 · 6 comments
Closed
1 of 2 tasks

[FR] Update date in "updated" field on stock allocation #5630

StormTrooper opened this issue Sep 28, 2023 · 6 comments
Labels
enhancement This is an suggested enhancement or new feature inactive Indicates lack of activity

Comments

@StormTrooper
Copy link

StormTrooper commented Sep 28, 2023

Please verify that this feature request has NOT been suggested before.

  • I checked and didn't find a similar feature request

Problem statement

Not sure if this is a FR or a bug - feels like a FR.

I have a script that syncs stock between Inventree and WooCommerce using an API.

So I call for example the below API to get the "quantity" and "updated" fields and if updated within the last day then I know the quantity has changed so I sync to WooCommerce. I need to use the "updated" field as only want to sync part stock values that have changed in the last day (Otherwise I will be syncing thousands of parts)

https://demo.inventree.org/api/stock/?format=json&part=69

"updated":"2023-09-28 10:28"

This has been working well but I've found a issue when I have a build order and allocate stock (I use the auto allocate) the stock quantity updates correctly but the "updated" date doesn't change.

The date is only changed when the build is completed.

I need to update the stock quantity before the build is complete as the build could take sometimes days to complete.

Suggested solution

Update the "updated" field as soon as the stock is allocated, or introduce a new stock_updated field.

Describe alternatives you've considered

The work around for this is to view the part and redo the count part stock - after this the date on the "updated" field is updated.

Examples of other systems

No response

Do you want to develop this?

  • I want to develop this.
@StormTrooper StormTrooper added enhancement This is an suggested enhancement or new feature triage:not-checked Item was not checked by the core team labels Sep 28, 2023
@SchrodingersGat
Copy link
Member

@StormTrooper the current behaviour makes sense - stock is allocated to the system but not actually "changed" (no stock is really drawn down).

I suppose that we could "touch" the last_updated date on the stock item whenever the allocations change?

@matmair
Copy link
Contributor

matmair commented Sep 29, 2023

I am not sure if a change in the current behaviour is warranted, it feels logical. There is no real change till stock is moved IMO. Before that, it is just earmarked.

@StormTrooper I would suggest using an event plugin if you want to sync stock - see my implementation for shopify here. Maybe I can expand my plugin also to WooCommerce, there seems to be interest in that.

@StormTrooper
Copy link
Author

@matmair Thanks for the link, will take a look. I've also got my script syncing to eBay so it's a not going to be a quick fix. (Actually script syncs both ways between WooCommerce/Ebay/Inventree)

Still not sure if I understand the current behaviour on stock levels.

If for example I have 10 resistors in stock and then start a build order which uses 5 resistors as soon as I assign stock, my stock levels have changed to 5. (I still have 10 resistors but only 5 are 'in stock' and usable for other builds/can be sold)

The updated field will only update when the build order is closed. Shouldn't it update as soon as the the stock is touched?

If I don't sync the new stock values to WooCommerce/eBay then I could protentially sell 10 resistors where I only have 5.

Is there any other trick I could use apart from an event? Worst case I can ignore the date and sync everything but that's overkill and a waste of resources.

@snorkrat
Copy link

I am not sure if a change in the current behaviour is warranted, it feels logical. There is no real change till stock is moved IMO. Before that, it is just earmarked.

@StormTrooper I would suggest using an event plugin if you want to sync stock - see my implementation for shopify here. Maybe I can expand my plugin also to WooCommerce, there seems to be interest in that.

I have been looking for a way to sync Inventree stock to WooCommerce and came across your comment. Not sure if other people would find this useful, but I'm adding a +1 for WooCommerce support if you feel like you want to implement!

@matmair
Copy link
Contributor

matmair commented Jan 10, 2024

@snorkrat I am looking into tackeling this at some point in the future by generalising the shopify plugin and adding more marketplaces. You can subscribe to this issue to get notifications if/when I find time to tackle this.

@matmair matmair removed the triage:not-checked Item was not checked by the core team label Jan 10, 2024
Copy link
Contributor

This issue seems stale. Please react to show this is still important.

@github-actions github-actions bot added the inactive Indicates lack of activity label Mar 11, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is an suggested enhancement or new feature inactive Indicates lack of activity
Projects
None yet
Development

No branches or pull requests

4 participants