Skip to content

[19.0][MIG] product_set: Migration to 19.0#2263

Open
CRogos wants to merge 24 commits into
OCA:19.0from
c4a8-odoo:copilot/migrate-product-set-18-0-to-19-0
Open

[19.0][MIG] product_set: Migration to 19.0#2263
CRogos wants to merge 24 commits into
OCA:19.0from
c4a8-odoo:copilot/migrate-product-set-18-0-to-19-0

Conversation

@CRogos
Copy link
Copy Markdown

@CRogos CRogos commented Apr 16, 2026

supersede: #2098

includes: #2201

  • Remove odoo_test_helper dependency — tests/models.py deleted
  • Convert product.set.wizard from AbstractModel to TransientModel
  • Fix test_product_set.py — replace all demo data env.ref() with programmatic record creation (including base.res_partner_1)
  • Fix test_product_set_line.py — UoM refs retained (module data, always available)
  • Fix test_product_set_wizard.py — fully programmatic, no demo refs

@Saran440, @rousseldenis. @mmrondon Could you please review?
There were a few (breaking) changes necessary. Could you have a close look on the changes and test.

Christopher Rogos and others added 22 commits April 16, 2026 14:17
[UPD] Update product_set.pot

[UPD] README.rst

Translated using Weblate (Spanish)

Currently translated at 100.0% (23 of 23 strings)

Translation: product-attribute-16.0/product-attribute-16.0-product_set
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_set/es/

[UPD] README.rst

Translated using Weblate (Portuguese (Brazil))

Currently translated at 100.0% (23 of 23 strings)

Translation: product-attribute-16.0/product-attribute-16.0-product_set
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_set/pt_BR/

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: product-attribute-16.0/product-attribute-16.0-product_set
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_set/

Translated using Weblate (Italian)

Currently translated at 100.0% (23 of 23 strings)

Translation: product-attribute-16.0/product-attribute-16.0-product_set
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_set/it/
[UPD] Update product_set.pot

[BOT] post-merge updates

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: product-attribute-16.0/product-attribute-16.0-product_set
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_set/

Translated using Weblate (Spanish)

Currently translated at 100.0% (29 of 29 strings)

Translation: product-attribute-16.0/product-attribute-16.0-product_set
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_set/es/

Translated using Weblate (Italian)

Currently translated at 100.0% (29 of 29 strings)

Translation: product-attribute-16.0/product-attribute-16.0-product_set
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_set/it/
… in the module sale_product_set.

The reason to move this logic is that there are other modules that extend
product_set as for example stock_product_set but at the same time make use
of the transient model to define a wizard. For this reason it is better to
have the logic available in this base module and avoid duplicating code or
inheriting from sale_product_set and what this implies in their respective
dependencies with the only need to extend the transient model.
In addition, the transient model is renamed to make it clearer to identify
that it is this type of model.

TT48100

[UPD] Update product_set.pot

[BOT] post-merge updates

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: product-attribute-16.0/product-attribute-16.0-product_set
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_set/

Translated using Weblate (Italian)

Currently translated at 100.0% (32 of 32 strings)

Translation: product-attribute-16.0/product-attribute-16.0-product_set
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_set/it/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: product-attribute-17.0/product-attribute-17.0-product_set
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-17-0/product-attribute-17-0-product_set/
Currently translated at 100.0% (33 of 33 strings)

Translation: product-attribute-17.0/product-attribute-17.0-product_set
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-17-0/product-attribute-17-0-product_set/de/
Currently translated at 100.0% (33 of 33 strings)

Translation: product-attribute-17.0/product-attribute-17.0-product_set
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-17-0/product-attribute-17-0-product_set/es/
Currently translated at 100.0% (33 of 33 strings)

Translation: product-attribute-17.0/product-attribute-17.0-product_set
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-17-0/product-attribute-17-0-product_set/it/
Currently translated at 100.0% (33 of 33 strings)

Translation: product-attribute-17.0/product-attribute-17.0-product_set
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-17-0/product-attribute-17-0-product_set/sv/
Currently translated at 93.9% (31 of 33 strings)

Translation: product-attribute-17.0/product-attribute-17.0-product_set
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-17-0/product-attribute-17-0-product_set/zh_TW/
Currently translated at 100.0% (33 of 33 strings)

Translation: product-attribute-17.0/product-attribute-17.0-product_set
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-17-0/product-attribute-17-0-product_set/it/
Currently translated at 100.0% (36 of 36 strings)

Translation: product-attribute-18.0/product-attribute-18.0-product_set
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-18-0/product-attribute-18-0-product_set/it/
In v18 the archive/unarchive action is visible only if the field is not readonly
hence we cannot use a related field anymore.
* ease filtering on set and set line views
* allow viewing and toggling archived lines on set form
Currently translated at 100.0% (37 of 37 strings)

Translation: product-attribute-18.0/product-attribute-18.0-product_set
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-18-0/product-attribute-18-0-product_set/it/
Currently translated at 18.9% (7 of 37 strings)

Translation: product-attribute-18.0/product-attribute-18.0-product_set
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-18-0/product-attribute-18-0-product_set/tr/
With the changes introduced in odoo/odoo@de056cc#diff-b37c7fd5520c97a29ddc59495779e7be61a66e15e85603928e27b3affb9dc31f, an error was occurring because the change validation on the model was being performed before tearDownClass was executed. Therefore, it has been modified so that the mock changes are applied in each test and cleaned up after each test. This way, the error will no longer appear and the test will run normally.
@CRogos CRogos force-pushed the copilot/migrate-product-set-18-0-to-19-0 branch 5 times, most recently from c9fd859 to 5813d5f Compare April 17, 2026 12:37
Copy link
Copy Markdown
Contributor

@BhaveshHeliconia BhaveshHeliconia left a comment

Choose a reason for hiding this comment

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

Code review LGTM!

@CRogos CRogos force-pushed the copilot/migrate-product-set-18-0-to-19-0 branch from 5813d5f to 76d5f2b Compare April 30, 2026 20:26
@CRogos CRogos force-pushed the copilot/migrate-product-set-18-0-to-19-0 branch from 76d5f2b to 648f91a Compare May 4, 2026 08:00
@CRogos
Copy link
Copy Markdown
Author

CRogos commented May 4, 2026

@pedrobaeza could you have a look and merge?

@pedrobaeza
Copy link
Copy Markdown
Member

/ocabot migration product_set

@OCA-git-bot OCA-git-bot added this to the 19.0 milestone May 4, 2026
@OCA-git-bot
Copy link
Copy Markdown
Contributor

The migration issue (#2075) has not been updated to reference the current pull request because a previous pull request (#2098) is not closed.
Perhaps you should check that there is no duplicate work.
CC @mmrondon

@pedrobaeza
Copy link
Copy Markdown
Member

/ocabot migration product_set

@OCA-git-bot OCA-git-bot mentioned this pull request May 4, 2026
73 tasks
Comment thread product_set/models/product_set_line.py Outdated
"res.company", related="product_set_id.company_id", store=True, readonly=True
)
name = fields.Char()
product_packaging_id = fields.Many2one(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why removing the package part?

Copy link
Copy Markdown
Author

@CRogos CRogos May 4, 2026

Choose a reason for hiding this comment

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

Because there is no product.packaging anymore.

https://github.com/OCA/OpenUpgrade/blob/c7c7393fc92c11fefbe644b6032e3c967dd3f40d/openupgrade_scripts/scripts/product/19.0.1.2/pre-migration.py#L71

(but take your time if you want to have a closer look into this change)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK, then you would need to add migration scripts to get uom_id filled according OpenUpgrade changes. And what about testing this new field?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Could you have a look at the migration script. I currently have no setup how to test it.

@CRogos CRogos marked this pull request as draft May 4, 2026 14:08
@CRogos CRogos force-pushed the copilot/migrate-product-set-18-0-to-19-0 branch 2 times, most recently from 9a78e9c to ccfe644 Compare May 4, 2026 16:18
@CRogos CRogos marked this pull request as ready for review May 4, 2026 16:33
@OCA-git-bot
Copy link
Copy Markdown
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

Comment thread product_set/models/product_set_line.py Outdated
inverse="_inverse_product_packaging_qty",
digits="Product Unit of Measure",
uom_id = fields.Many2one(
"uom.uom",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Now looking better at the migration script, this should be product.uom not uom.uom.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

should we rename the field from uom_id to product_uom_id?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If it's the usual nomenclature for this relation (and it seems it is), yes.

cr.execute(
"""
UPDATE product_set_line psl
SET uom_id = pt.uom_id
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As the product_uom is the same as the product_packaging one, you only need to copy its value.

@CRogos CRogos force-pushed the copilot/migrate-product-set-18-0-to-19-0 branch from ccfe644 to bd8886c Compare May 4, 2026 18:22
@CRogos CRogos marked this pull request as draft May 4, 2026 18:54
@CRogos CRogos force-pushed the copilot/migrate-product-set-18-0-to-19-0 branch from bd8886c to 2c3e26d Compare May 5, 2026 11:11
@CRogos CRogos marked this pull request as ready for review May 5, 2026 12:46
@CRogos
Copy link
Copy Markdown
Author

CRogos commented May 5, 2026

@MohamedOsman7 @BhaveshHeliconia could you retest? Due to pedros valid feedback, there has been some changes in the implementation.

@CRogos CRogos force-pushed the copilot/migrate-product-set-18-0-to-19-0 branch from 2c3e26d to aaa1461 Compare May 5, 2026 16:49
@MohamedOsman7
Copy link
Copy Markdown
Contributor

MohamedOsman7 commented May 7, 2026

@CRogos I am encountering now the same issue as here: OCA/sale-workflow#4283 (comment)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.