d08b4407be3cf9b404087056a413fbdc9eecbd9d
_get_available_qty and tracked products
Suppose you have a product tracked by serial number. In your inventory, you have two quants: -1 for serial1, +1 for serial2. If you create a move for 1 product and try to run `action_assign`, it didn't work before this patch because stock.move's `_update_reserved_quantity` is guarded by a call to an unstricted `_get_available_quantity` (unstricted meaning considering all quants regardless of their lot_id/package_id/owner_id). This call resulted in an available quantity of 0, thus the stock move could not be reserved To fix this issue, we patched `_get_available_quantity` so that it rightly considers products of different lot_id as different products, i.e. it returns an available quantity of +1 in the initial scenario. Of course, we consider all quants of the same lot_id, i.e. if you have -1 for serial1 and +1 for serial2, the available quantity amounts to 0. In another scenario, let's say we have only -1 serial1 in stock, if we run `_get_available_quantity`, the method should return 0: nothing is reservable. We continue this reasonment by returning 0 everytime the available quantity is negative, tracked or not. This is probably what a method named `_get_available_quantity` should have done since the beginning. There's only a single case where we need to know the quantity even if it's negative: it's just after we move a quant to its destination location. If this quant was tracked and resulted in a negative quant (i.e. we moved something we didn't have), we try to compensate with an untracked quant. In this special case, we do not want to ignore the negative quants when calling `_get_available_quantity`. That's why we introduce a new argument to this method. We could have added a new method `_get_quantity` for clarity sake.
…
Odoo
Odoo is a suite of web based open source business apps.
The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, Purchase Management, ...
Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.
Getting started with Odoo
For a standard installation please follow the Setup instructions from the documentation.
If you are a developer you may type the following command at your terminal:
wget -O- https://raw.githubusercontent.com/odoo/odoo/master/setup/setup_dev.py | python
Then follow the developer tutorials
For Odoo employees
To add the odoo-dev remote use this command:
$ ./setup/setup_dev.py setup_git_dev
To fetch odoo merge pull requests refs use this command:
$ ./setup/setup_dev.py setup_git_review
Languages
Python
49.6%
JavaScript
47.8%
SCSS
2%
CSS
0.3%
HTML
0.2%