-
-
Notifications
You must be signed in to change notification settings - Fork 784
[17.0][OU-ADD] product: migrate to 17.0 #4468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
daiduongnguyen-odoo
wants to merge
1
commit into
OCA:17.0
from
daiduongnguyen-odoo:v17_ou_add_product
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
10 changes: 10 additions & 0 deletions
10
openupgrade_scripts/scripts/product/17.0.1.2/post-migration.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Copyright 2024 Viindoo Technology Joint Stock Company (Viindoo) | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from openupgradelib import openupgrade | ||
|
|
||
|
|
||
| @openupgrade.migrate() | ||
| def migrate(env, version): | ||
| openupgrade.load_data(env, "product", "17.0.1.2/noupdate_changes.xml") | ||
| openupgrade.delete_records_safely_by_xml_id(env, ["product.list0"]) |
31 changes: 31 additions & 0 deletions
31
openupgrade_scripts/scripts/product/17.0.1.2/pre-migration.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # Copyright 2024 Viindoo Technology Joint Stock Company (Viindoo) | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from openupgradelib import openupgrade | ||
|
|
||
|
|
||
| @openupgrade.migrate() | ||
| def migrate(env, version): | ||
| openupgrade.logged_query( | ||
| env.cr, | ||
| """ | ||
| ALTER TABLE product_tag | ||
| ALTER COLUMN color TYPE VARCHAR USING color::VARCHAR; | ||
|
|
||
| UPDATE product_tag | ||
| SET color = CASE | ||
| WHEN color = '1' THEN '#F06050' | ||
| WHEN color = '2' THEN '#F4A460' | ||
| WHEN color = '3' THEN '#F7CD1F' | ||
| WHEN color = '4' THEN '#6CC1ED' | ||
| WHEN color = '5' THEN '#814968' | ||
| WHEN color = '6' THEN '#EB7E7F' | ||
| WHEN color = '7' THEN '#2C8397' | ||
| WHEN color = '8' THEN '#475577' | ||
| WHEN color = '9' THEN '#D6145F' | ||
| WHEN color = '10' THEN '#30C381' | ||
| WHEN color = '11' THEN '#9365B8' | ||
| ELSE '#3C3C3C' | ||
| END; | ||
| """, | ||
| ) |
91 changes: 91 additions & 0 deletions
91
openupgrade_scripts/scripts/product/17.0.1.2/upgrade_analysis_work.txt
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| ---Models in module 'product'--- | ||
| obsolete model report.product.report_producttemplatelabel [abstract] | ||
| new model product.catalog.mixin [abstract] | ||
| new model product.document | ||
| new model report.product.report_producttemplatelabel2x7 [abstract] | ||
| new model report.product.report_producttemplatelabel4x12 [abstract] | ||
| new model report.product.report_producttemplatelabel4x12noprice [abstract] | ||
| new model report.product.report_producttemplatelabel4x7 [abstract] | ||
| # NOTHING TO DO | ||
|
|
||
| ---Fields in module 'product'--- | ||
| product / product.attribute / display_type (selection) : selection_keys is now '['color', 'multi', 'pills', 'radio', 'select']' ('['color', 'pills', 'radio', 'select']') | ||
| # NOTHING TO DO: add new selection: multi | ||
|
|
||
| product / product.attribute.value / default_extra_price (float) : NEW | ||
| product / product.attribute.value / image (binary) : NEW attachment: True | ||
| product / product.category / product_properties_definition (properties_definition): NEW | ||
| # NOTHING TO DO: new feature | ||
|
|
||
| product / product.document / _inherits : NEW _inherits: {'ir.attachment': 'ir_attachment_id'} | ||
| product / product.document / active (boolean) : NEW hasdefault: default | ||
| product / product.document / ir_attachment_id (many2one) : NEW relation: ir.attachment, required | ||
| # NOTHING TO DO: fields in new model | ||
|
|
||
| product / product.packaging / product_id (many2one) : now required | ||
| # NOTHING TO DO | ||
|
|
||
| product / product.pricelist / _order : _order is now 'sequence asc, id asc' ('sequence asc, id desc') | ||
| product / product.pricelist / activity_ids (one2many) : NEW relation: mail.activity | ||
| product / product.pricelist / message_follower_ids (one2many): NEW relation: mail.followers | ||
| product / product.pricelist / message_ids (one2many) : NEW relation: mail.message | ||
| # NOTHING TO DO | ||
|
|
||
| product / product.pricelist.item / active (boolean) : DEL | ||
| # NOTHING TO DO | ||
|
|
||
| product / product.product / activity_user_id (many2one) : not related anymore | ||
| product / product.product / activity_user_id (many2one) : now a function | ||
| product / product.product / message_main_attachment_id (many2one): DEL relation: ir.attachment | ||
| product / product.product / product_document_ids (one2many): NEW relation: product.document | ||
| # NOTHING TO DO | ||
|
|
||
| product / product.supplierinfo / discount (float) : NEW | ||
| # NOTHING TO DO | ||
|
|
||
| product / product.tag / color (integer) : type is now 'char' ('integer') | ||
| # DONE: handled in pre-migration | ||
|
|
||
| product / product.template / activity_user_id (many2one) : not related anymore | ||
| product / product.template / activity_user_id (many2one) : now a function | ||
| product / product.template / message_main_attachment_id (many2one): DEL relation: ir.attachment | ||
| product / product.template / product_document_ids (one2many): NEW relation: product.document | ||
| product / product.template / product_properties (properties): NEW hasdefault: compute | ||
| # NOTHING TO DO | ||
|
|
||
| product / product.template.attribute.line / _order : _order is now 'sequence, attribute_id, id' ('attribute_id, id') | ||
| product / product.template.attribute.line / sequence (integer) : NEW hasdefault: default | ||
| # NOTHING TO DO: new feature | ||
|
|
||
| ---XML records in module 'product'--- | ||
| NEW ir.actions.report: product.report_product_template_label_2x7 | ||
| NEW ir.actions.report: product.report_product_template_label_4x12 | ||
| NEW ir.actions.report: product.report_product_template_label_4x12_noprice | ||
| NEW ir.actions.report: product.report_product_template_label_4x7 | ||
| DEL ir.actions.report: product.report_product_template_label | ||
| NEW ir.model.access: product.access_product_document_user | ||
| NEW ir.model.constraint: product.constraint_product_attribute_check_multi_checkbox_no_variant | ||
| # NOTHING TO DO | ||
|
|
||
| NEW ir.rule: product.product_document_comp_rule (noupdate) | ||
| NEW ir.ui.view: product.product_attribute_value_list | ||
| NEW ir.ui.view: product.product_document_form | ||
| NEW ir.ui.view: product.product_document_kanban | ||
| NEW ir.ui.view: product.product_document_list | ||
| NEW ir.ui.view: product.product_document_search | ||
| NEW ir.ui.view: product.product_product_view_tree_tag | ||
| NEW ir.ui.view: product.product_template_view_tree_tag | ||
| NEW ir.ui.view: product.product_view_kanban_catalog | ||
| NEW ir.ui.view: product.product_view_search_catalog | ||
| NEW ir.ui.view: product.report_producttemplatelabel2x7 | ||
| NEW ir.ui.view: product.report_producttemplatelabel4x12 | ||
| NEW ir.ui.view: product.report_producttemplatelabel4x12noprice | ||
| NEW ir.ui.view: product.report_producttemplatelabel4x7 | ||
| NEW ir.ui.view: product.report_simple_label4x12_no_price | ||
| # NOTHING TO DO | ||
|
|
||
| DEL ir.ui.view: product.report_producttemplatelabel | ||
| # NOTHING TO DO | ||
|
|
||
| DEL product.pricelist: product.list0 (noupdate) | ||
| DONE: delete in post-migration | ||
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not the attachment from product be also created in product.document model ?
I guess we should do something similar to https://github.com/odoo/odoo/blob/24c2b7bf95e494157fd4d93bbf159a04ce9f1ee6/addons/product/models/ir_attachment.py#L14-L24
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh seem make sense