Skip to content

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

Open
StefanRijnhart wants to merge 56 commits intoOCA: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 56 commits intoOCA:18.0from
StefanRijnhart:18.0-mig-stock_available_mrp

Conversation

@StefanRijnhart
Copy link
Copy Markdown
Member

@StefanRijnhart StefanRijnhart commented Dec 22, 2025

Superseding #38

sbidoul and others added 15 commits December 22, 2025 10:42
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.
    * mrp_bom.name has been deleted.
    * mrp_bom_line.type moved to mrp_bom.type.
    * Fix missing group_mrp_user issue.
    * Change versions
@StefanRijnhart StefanRijnhart force-pushed the 18.0-mig-stock_available_mrp branch 2 times, most recently from c10521e to b9a501a Compare December 22, 2025 10:19
florian-dacosta and others added 9 commits December 22, 2025 11:20
Currently translated at 100.0% (7 of 7 strings)

Translation: stock-logistics-warehouse-12.0/stock-logistics-warehouse-12.0-stock_available_mrp
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_available_mrp/zh_CN/
Currently translated at 100.0% (7 of 7 strings)

Translation: stock-logistics-warehouse-12.0/stock-logistics-warehouse-12.0-stock_available_mrp
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_available_mrp/fr/
After this change odoo/odoo@3d34d58
it isn't possible to have an storable kit product anymore. The main
issue is that we have to drop some uses cases that this module
considered for this kind of situations.
In Odoo change odoo/odoo@3d34d58 the products with Kit BoMs couldn't
longer be other than `consu`. This was reverted in odoo/odoo@6c4623a
and some products are raising errors when forcing the type
@StefanRijnhart StefanRijnhart force-pushed the 18.0-mig-stock_available_mrp branch from b9a501a to 025b0e7 Compare December 22, 2025 10:20
@StefanRijnhart StefanRijnhart force-pushed the 18.0-mig-stock_available_mrp branch from 025b0e7 to 34dbfec Compare December 22, 2025 10:23
jabelchi and others added 12 commits December 22, 2025 11:24
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 StefanRijnhart force-pushed the 18.0-mig-stock_available_mrp branch 4 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 2 times, most recently from 224cb3c to eb9b6df Compare December 22, 2025 11:24
@StefanRijnhart StefanRijnhart force-pushed the 18.0-mig-stock_available_mrp branch from eb9b6df to 5151f39 Compare December 22, 2025 11:25
…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.
@StefanRijnhart StefanRijnhart force-pushed the 18.0-mig-stock_available_mrp branch from 5151f39 to 093f7a0 Compare December 22, 2025 19:40
Copy link
Copy Markdown

@ellbristow ellbristow left a comment

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

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.