Skip to content

[18.0][MIG] stock_available_mrp: Migration to 18.0#68

Open
StefanRijnhart wants to merge 58 commits into
OCA:18.0from
StefanRijnhart:18.0-mig-stock_available_mrp
Open

[18.0][MIG] stock_available_mrp: Migration to 18.0#68
StefanRijnhart wants to merge 58 commits into
OCA:18.0from
StefanRijnhart:18.0-mig-stock_available_mrp

Conversation

@StefanRijnhart

@StefanRijnhart StefanRijnhart commented Dec 22, 2025

Copy link
Copy Markdown
Member

Superseding #38

@StefanRijnhart StefanRijnhart force-pushed the 18.0-mig-stock_available_mrp branch 8 times, most recently from c460a23 to 46b084b Compare December 22, 2025 11:13
@StefanRijnhart StefanRijnhart marked this pull request as ready for review December 22, 2025 11:20
@StefanRijnhart

Copy link
Copy Markdown
Member Author

/ocabot migration stock_available_mrp

@OCA-git-bot OCA-git-bot added this to the 18.0 milestone Dec 22, 2025
@OCA-git-bot OCA-git-bot mentioned this pull request Dec 22, 2025
7 tasks
@StefanRijnhart StefanRijnhart force-pushed the 18.0-mig-stock_available_mrp branch 4 times, most recently from 5151f39 to 093f7a0 Compare December 22, 2025 19:40

@ellbristow ellbristow left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This caused problems for one of our customers who send the immediately usable quantity to Magento via EDI and it was sending the wrong stock figures.

)

res[product.id]["potential_qty"] = potential_qty
res[product.id]["immediately_usable_qty"] += potential_qty

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In the case of Kits this is wrong. Odoo already includes the buildable quantity upstream, so this modification is adding additional stock (double counting the Available stock). By returning this to = and limiting this to Kits, both kits and manufactured show the correct Available qty.

Suggested change
res[product.id]["immediately_usable_qty"] += potential_qty
if bom_id.type == "phantom":
res[product.id]["immediately_usable_qty"] = potential_qty

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Apologies for the late response and thank you very much for suggesting the fix. Added in a separate commit.

@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions Bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Jun 7, 2026
@OCA-git-bot OCA-git-bot added series:18.0 mod:stock_available_mrp Module stock_available_mrp labels Jun 8, 2026
sbidoul and others added 8 commits June 8, 2026 14:54
Compute potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Take all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA/stock-logistics-warehouse#5 (comment)
Improve tests, rewritten in python.
Adhere to new file/manifest/README conventions.
Simplify copyright headers
sudo is not required since mrp.bom are readable to groups with access to the qty_x fields on a product. Moreover using sudo to retrive the bom will ignore the company_id defined on the bom
Record rules used to not be checked on stock quants, but now they are since Odoo's commit 2fd14db57433d08ab368a7e18d18ae8d49dafab1 (odoo/odoo@2fd14db).
In our test we changed the company of the products and BoMs but we neglected that the stock was not attached to the right company, and that made the test fail.
To fix that, make the test inventory for the right company.
Since there is a little inconsistency in the demo data with a negative quantity of an unrelated product, use the `partial` filter for the inventories instead of the `none` filter, so that no wrong inventory lines are added automatically.
rousseldenis and others added 14 commits June 8, 2026 14:54
Currently translated at 100.0% (5 of 5 strings)

Translation: stock-logistics-warehouse-15.0/stock-logistics-warehouse-15.0-stock_available_mrp
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-15-0/stock-logistics-warehouse-15-0-stock_available_mrp/ca/
Currently translated at 100.0% (10 of 10 strings)

Translation: stock-logistics-availability-16.0/stock-logistics-availability-16.0-stock_available_mrp
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-availability-16-0/stock-logistics-availability-16-0-stock_available_mrp/es/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: stock-logistics-availability-16.0/stock-logistics-availability-16.0-stock_available_mrp
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-availability-16-0/stock-logistics-availability-16-0-stock_available_mrp/
Currently translated at 100.0% (2 of 2 strings)

Translation: stock-logistics-availability-16.0/stock-logistics-availability-16.0-stock_available_mrp
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-availability-16-0/stock-logistics-availability-16-0-stock_available_mrp/es/
Currently translated at 100.0% (2 of 2 strings)

Translation: stock-logistics-availability-16.0/stock-logistics-availability-16.0-stock_available_mrp
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-availability-16-0/stock-logistics-availability-16-0-stock_available_mrp/it/
When a BoM is linked just to one variant through field `product_id`,
it is taken in account when computing stock of the rest of variants
of the same template.
Currently translated at 100.0% (6 of 6 strings)

Translation: stock-logistics-availability-17.0/stock-logistics-availability-17.0-stock_available_mrp
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-availability-17-0/stock-logistics-availability-17-0-stock_available_mrp/it/
StefanRijnhart and others added 5 commits June 8, 2026 15:34
…ameters

The configuration parameter in which the field to use was stored was actually not
used. Instead, another configuration parameter, for which a default value was
provided in xml data was used.
Use variant-specific BoMs when computing potential stock, including nested phantom BoMs, instead of selecting the first template BoM.
@StefanRijnhart StefanRijnhart force-pushed the 18.0-mig-stock_available_mrp branch 3 times, most recently from 779397f to 7f0c794 Compare June 8, 2026 13:41
… for kit products

Co-authored-by: Elliott Bristow <elliott@glo.systems>
@StefanRijnhart StefanRijnhart force-pushed the 18.0-mig-stock_available_mrp branch from 7f0c794 to 728d4b3 Compare June 8, 2026 13:42
@github-actions github-actions Bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:stock_available_mrp Module stock_available_mrp series:18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.