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

[FIX] stock: Reformulation of the quantity constraint by the quants #7

Open
wants to merge 1 commit into
base: 14.0
Choose a base branch
from

Conversation

BernatPForgeFlow
Copy link

Description of the issue/feature this PR addresses:

Situation 1: A quant of a serial product must be able to have more than one unit as long as the sum of all the quants of that serial product and at that location is not greater than 1. That is, a product must be able to return more than once.

Situation 2: At the same time, a serial product should not have more than one unit in a location that is not of the 'Inventory Loss' type.

To ensure that you do not have a duplicate serial product in a location it is necessary that the absolute value of the sum of the quantities of that product in that location is less than 1. This is mainly thought for products that are stored in Units. If a product is stored in 'kilograms' (grams), you could have more than one quant in 'WH/ Stock' if the sum of the quantities is less than 1.

Current behavior before PR:

Situation 1: You can't return a serial product more than once if it went out with different packages because it would end up with a quant in 'WH/Customers' location of -2 units. Check how to reproduce steps at the end of the description.

2023-07-17.12-17-46.mov

Situation 2: You are allowed to have more than one unit of a serial product in 'Stock' location. You can arrive in this situation if packages are different.

2023-07-17.12-01-30.mov

Desired behavior after PR is merged:

Situation 1: You can return a serial product more than once if it went out with different packages. A quant can end up with -2 units in 'WH/Customers' location.

2023-07-17.12-36-17.mov

Situation 2: You are not allowed to have more than one unit of a serial product in 'Stock' location.

2023-07-17.12-08-28.mov

How to reproduce the issue:

Situation 1:

  1. Create a serialized product and add 1 unit in stock
  2. Deliver the product to a customer, with a package
  3. Return the product to stock, and create an incoming shipment. Complete it.
  4. Deliver the product again to the customer, this time creating another package before shipping.
  5. Click to return the product in the delivery order, and create an incoming shipment. At this time the error occurs.

Situate 2:

  1. Create a stock quant for a serialized product with a package in 'WH/Stock'.
  2. Create another stock quant for the same serialized product with a different package in 'WH/Stock'. At this time the error should occur.

I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

A quant of a serial product must be able to have more than one unit as long as the sum of all the quants of that serial product and at that location is not greater than 1. That is, a product must be able to return more than once.

At the same time, a serial product should not have more than one unit in a location that is not of the 'Inventory Loss' type.
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.

1 participant