Repository navigation
Conversation
rrebollo
force-pushed
the
18.0-ou-fix-product-type-defaults
branch
3 times, most recently
from
November 24, 2026 16:25
a10d86a to
40d30e4
Compare
From 14 to 17, `stock` added 'product' to product.template.type; 18 removed
both the value and the field's meaning, so a DB that still carries a default
for it raises ValueError on every new product:
ValueError: Wrong value for product.template.type: 'product'
stock/18.0.1.1/pre-migration.py converts the stored rows but leaves the
ir.default entries alone. This rewrites the dead defaults to "consu" and adds
is_storable=true at the same scope.
The script lives in end-migration on purpose: is_storable comes from stock,
whose fields are not reflected yet when product runs its post-migration.
Only rows holding the dead value are selected, so a second run is a no-op.
The test asserts the rewritten values at post_install, once the end scripts
have run.
rrebollo
force-pushed
the
18.0-ou-fix-product-type-defaults
branch
from
November 24, 2026 17:44
40d30e4 to
135597f
Compare
rrebollo
marked this pull request as ready for review
November 24, 2026 17:45
This was referenced Nov 24, 2026
sergiocorato
approved these changes
Nov 24, 2026
|
|
||
| def test_product_type_defaults(self): | ||
| default = self.env["ir.default"] | ||
| self.assertEqual(default._get("product.template", "type"), "consu") |
There was a problem hiding this comment.
Here you could simply create a product.template and check its type and is_storable field.
| partner.property_product_pricelist = pricelist_main | ||
| partner.with_company(company).property_product_pricelist = pricelist | ||
|
|
||
| env["ir.default"].set("product.template", "type", "product") |
There was a problem hiding this comment.
You could add a comment to say it's a value set for test with pre-18 behaviour.
|
|
||
|
|
||
| @openupgrade_test | ||
| @tagged("post_install", "-at_install") |
There was a problem hiding this comment.
This change would modify test's condition of test_pricelist(), it's better to add a new class for the new test.
This branch has not been deployed
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.
Databases created in v14 may retain
ir.defaultrows forproduct.template.type = "product", a selection removed in v18. This breaks new product creation. Rewrite those defaults totype = "consu"andis_storable = truein end-migration, afterstockis loaded.@BinhexTeam T26823