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

[14.0][IMP] stock_reserve: Substract Forecasted Quantity from products according to configuration option #1859

Closed

Conversation

victoralmau
Copy link
Member

@victoralmau victoralmau commented Oct 6, 2023

Substract Forecasted Quantity from products according to configuration option.

Example use case:

  • Product with stock 10 > Forectasted = 10
  • Create an outgoing picking of 10 qty > Forectasted = 0
  • Create a reservation of 10 qty + reserve > Forecasted = 0
  • Release the reserve > Forecasted = 0

Please @pedrobaeza can you review it?

@Tecnativa TT43413

@pedrobaeza pedrobaeza added this to the 14.0 milestone Oct 6, 2023
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

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

Seeing the tests, it seems the initial intention is that the quantities to be substracted from the forecasted quantity which I don't see before.

This is something reasonable for reservation in sales quotations, where you want to already have less quantity. There are 2 ways then:

  1. Add an option to substract or not, global by company or per reservation (this second one is more flexible, but more difficult to be implemented).
  2. Do this for our custom case apart from the standard OCA, as we will have only the case of not substracting.

I think we are going to the point 2 in this occasion.

stock_reserve/models/product.py Outdated Show resolved Hide resolved
@victoralmau victoralmau force-pushed the 14.0-fix-stock_reserve-TT43413 branch from 005b430 to d2a8906 Compare October 6, 2023 12:02
@victoralmau victoralmau changed the title [14.0][FIX] stock_reserve: Set the correct forecasted quantity on products [14.0][IMP] stock_reserve: Substract Forecasted Quantity from products according to configuration option Oct 6, 2023
@victoralmau
Copy link
Member Author

Changes done.

:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&target_branch=14.0
:alt: Try me on Runboat
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/153/14.0
Copy link
Member

Choose a reason for hiding this comment

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

You have an outdated README generator. Please update your local maintainer-tools installation

"""Add location reservation for avoiding reservations to be substracted on
the forecasted quantity.
"""
company = self.company_id or self.env.company
Copy link
Member

Choose a reason for hiding this comment

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

This is not valid, as products by default don't have company, so this is always going to take the main company, which is not what is needed, specially on things coming from OdooBot. Argument company_id is not filled? If any doubt about the company passed, please go back to what I asked to put this on custom.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, taking into account what you indicate, we add this to custom (subtract always) and leave this PR to implement option 1 (more difficult to implement)

Copy link
Member

Choose a reason for hiding this comment

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

But it won't be valid if the company is not perfectly guessed.

Copy link
Member Author

Choose a reason for hiding this comment

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

With option 1 yes: Define for each reservation whether to subtract or not (auto-defining the value of a new field according to the company configuration), but the filter to be performed would be more complex than just by location.

@pedrobaeza
Copy link
Member

Let's abort this, as it's not easily done.

@pedrobaeza pedrobaeza closed this Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants