[19.0][MIG] stock_available: Migration to 19.0#78
Closed
dnplkndll wants to merge 57 commits into
Closed
Conversation
Generic module to compute the stock quantity available to promise using several implementations. stock_available_immediatly is changed to become the first optional implementation. Cherry pick of commit 0b060f619fa5d60f9fb343afe1154acd5c730148 from the v7 branch [IMP] stock_available* uses new API [ADD] stock_available_mrp Module to take immediate manufaturing capability into account in the stock quantity available to promise. Conflicts: stock_available/res_config.py [DEL] move stock_available_mrp to __unported__ [ADD] stock_available_sale Take sale quotations into account in the stock quantity available to promise Cherry-picked from 497068f5f5f1d65fdd4a6e90a787eba37b4e3232 Conflicts: stock_available/res_config.py [DEL] move stock_available_sale to __unported__ [IMP] READMEs and TODOs Cherry-picked from v7 at 8add4bea7e91924983fb29966e14a1f0d4d5332e Conflicts: __unported__/stock_available_mrp/__openerp__.py stock_available/__openerp__.py stock_available_immediately/__openerp__.py [IMP] respect product decimal precision odoo/odoo#5512 and odoo-dev/odoo@b3e5a94 makes it clear the standard intends to support decimal precision on the product form.
…uct and product.template, now takes in account variants and correctly displays value. [FLAKE8] Removing duplicate modules and moving README.rst into __unported__ [ADD} location calculations [FIX] typo
not using internal qty_available that seems not to take in consideration reserved quants. [ADD] Tests
Commit 6c16913 changed the way we compute the immediately_usable_qty: instead of using the virtual stock, we used the sum of quants without reservations. But a quant may actually be reserved and still be available (for example it may be reserved for an internal move). Fixes OCA/stock-logistics-warehouse#79 Remove loop and use correct decorator Restore the features of stock_available_immediately The previous fix restored stock_available but then there was no way to exclude the incomming moves from the count. This belongs in stock_available_immediately, restoring it cleanly. This commit also takes care to respect the distinction between templates and variants, so it should fix OCA/stock-logistics-warehouse#73 too. Restore the qty avail. to promise on variant treeview PEP8
* fix the dependencies for the computed field * use api.multi instead of api.one to avoid calling super()._immediately_usable_qty in a loop (this improves perfs on a tree view display)
There are cases where we dot NOT want to simply sum the quantities of all the variants. For example when dealing with manufacturing capacities, we may have to chose between variants because we can't make ALL of them with the same components. So instead of a simple non-modular implementation, we'll let each module define his own implementation of how to compute the product template's quantity available for sale. Conflicts: stock_available/__openerp__.py stock_available_immediately/__openerp__.py
…ch field use to compute potential
[CHG] improve code regarding code review [ADD] add test [CHG] optimize stock computation by avoiding to call useless compute
… related unit test Increase version number of the module
Currently translated at 61.9% (13 of 21 strings) Translation: stock-logistics-warehouse-11.0/stock-logistics-warehouse-11.0-stock_available Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-11-0/stock-logistics-warehouse-11-0-stock_available/ar/
Currently translated at 100.0% (21 of 21 strings) Translation: stock-logistics-warehouse-12.0/stock-logistics-warehouse-12.0-stock_available Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_available/pt_BR/
…ilable_immediately
Currently translated at 23.8% (5 of 21 strings) Translation: stock-logistics-warehouse-12.0/stock-logistics-warehouse-12.0-stock_available Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_available/zh_CN/
Currently translated at 100.0% (21 of 21 strings) Translation: stock-logistics-warehouse-15.0/stock-logistics-warehouse-15.0-stock_available Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-15-0/stock-logistics-warehouse-15-0-stock_available/ca/
Currently translated at 38.0% (8 of 21 strings) Translation: stock-logistics-warehouse-15.0/stock-logistics-warehouse-15.0-stock_available Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-15-0/stock-logistics-warehouse-15-0-stock_available/fr/
Currently translated at 63.1% (12 of 19 strings) Translation: stock-logistics-availability-16.0/stock-logistics-availability-16.0-stock_available Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-availability-16-0/stock-logistics-availability-16-0-stock_available/es/
Currently translated at 63.1% (12 of 19 strings) Translation: stock-logistics-availability-16.0/stock-logistics-availability-16.0-stock_available Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-availability-16-0/stock-logistics-availability-16-0-stock_available/es/
Currently translated at 100.0% (19 of 19 strings) Translation: stock-logistics-availability-16.0/stock-logistics-availability-16.0-stock_available Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-availability-16-0/stock-logistics-availability-16-0-stock_available/fr/
Currently translated at 100.0% (19 of 19 strings) Translation: stock-logistics-availability-16.0/stock-logistics-availability-16.0-stock_available Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-availability-16-0/stock-logistics-availability-16-0-stock_available/es/
Currently translated at 100.0% (19 of 19 strings) Translation: stock-logistics-availability-16.0/stock-logistics-availability-16.0-stock_available Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-availability-16-0/stock-logistics-availability-16-0-stock_available/it/
Currently translated at 100.0% (11 of 11 strings) Translation: stock-logistics-availability-17.0/stock-logistics-availability-17.0-stock_available Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-availability-17-0/stock-logistics-availability-17-0-stock_available/pt_BR/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Picking up the migration started in #66 by @kopeyev, which has been marked
stale(last activity 2026-04-19). All commits authored by @kopeyev are preserved unchanged.19.0 relevance
Core 19.0
stock/models/product.pyhasqty_available(on-hand) andfree_qty(on-hand − reservations) but does not addimmediately_usable_qty(Available To Promise: on-hand − reservations + incoming). ATP semantics matter for businesses with ongoing inbound supply where incoming stock should be sellable before it arrives. Module remains distinct from core.Non-mechanical adaptations worth flagging
from odoo.addons.stock.models.product import OPERATORS→import PY_OPERATORS as OPERATORS(core renamed the symbol in 19.0).self.search([])→self.search([], limit=None)(19.0 added an implicit default limit onsearch).TransactionCase→TestStockCommon(CI runs without demo data; switch to the stock helper that creates fixtures inline) + drop thenamefield fromstock.movecreate dicts (removed in 19.0; computed from product).Draft because it unblocks OCA/e-commerce#1220 (
website_sale_stock_availableMIG), which currently pinstest-requirements.txtto this branch. Will undraft once a reviewer signals.