Skip to content

Commit

Permalink
添加openupgrade_framework代码OCA#4327
Browse files Browse the repository at this point in the history
  • Loading branch information
xtanuiha committed May 30, 2024
1 parent 9279df1 commit c973596
Show file tree
Hide file tree
Showing 10 changed files with 271 additions and 151 deletions.
182 changes: 91 additions & 91 deletions docsource/modules160-170.rst

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions openupgrade_framework/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- call your odoo instance with the option
`--load=base,web,openupgrade_framework`

or

- add the key to your configuration file:

``` shell
[options]
server_wide_modules = web,openupgrade_framework
```

When you load the module in either way of these ways, and you have the
openupgrade_scripts module in your addons path available, the
--upgrade-path option of Odoo will be set automatically to the location
of the OpenUpgrade migration scripts.
2 changes: 2 additions & 0 deletions openupgrade_framework/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Stefan Rijnhart \<<[email protected]>\>
- Sylvain LE GAL \<<https://twitter.com/legalsylvain>\>
4 changes: 4 additions & 0 deletions openupgrade_framework/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Many developers have contributed to the OpenUpgrade framework in its
previous incarnation. Their original contributions may no longer needed,
or they are no longer recognizable in their current form but OpenUpgrade
would not have existed at this point without them.
29 changes: 29 additions & 0 deletions openupgrade_framework/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
This module is a technical module that contains a number of
monkeypatches to improve the behaviour of Odoo when migrating your
database using the OpenUpgrade migration scripts:

- Prevent dropping columns or tables in the database when fields or
models are obsoleted in the Odoo data model of the target release.
After the migration, you can review and delete unused database tables
and columns using database_cleanup. See
<https://odoo-community.org/shop/product/database-cleanup-918>
- When data records are deleted during the migration (such as views or
other system records), this is done in a secure mode. If the deletion
fails because of some unforeseen dependency, the deletion will be
cancelled and a message is logged, after which the migration
continues.
- Prevent a number of log messages that do not apply when using
OpenUpgrade.
- Suppress log messages about failed view validation, which are to be
expected during a migration.
- Run migration scripts for modules that are installed as new
dependencies of upgraded modules (when there are such scripts for
those particular modules)
- Production databases generated with demo data, will be transformed to
non-demo ones. If you want to avoid that, you have to pass through the
environment variable OPENUPGRADE_USE_DEMO, the value "yes".

For detailed documentation see:

- <https://github.com/OCA/OpenUpgrade/>
- <https://oca.github.io/OpenUpgrade>
50 changes: 50 additions & 0 deletions openupgrade_framework/readme/DEVELOP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
The odoo_patch folder contains python files in a tree that mimicks the
folder tree of the Odoo project. It contains a number of monkey patches
to improve the migration of an Odoo database between two major versions.

So far, we are able to make everything work without overwriting large
blocks of code, but if larger patches need to be added, please use the
method described below:

To see the patches added, you can use `meld` tools:

`meld PATH_TO_ODOO_FOLDER/odoo/ PATH_TO_OPENUPGRADE_FRAMEWORK_MODULE/odoo_patch`

To make more easy the diff analysis :

- Make sure the python files has the same path as the original one.
- Keep the same indentation as the original file. (using `if True:` if
required)
- Add the following two lines at the beginning of your file, to avoid
flake8 / pylint errors

``` python
# flake8: noqa
# pylint: skip-file
```

- When you want to change the code. add the following tags:

For an addition:

``` python
# <OpenUpgrade:ADD>
some code...
# </OpenUpgrade>
```

For a change:

``` python
# <OpenUpgrade:CHANGE>
some code...
# </OpenUpgrade>
```

For a removal:

``` python
# <OpenUpgrade:REMOVE>
# Comment the code, instead of removing it.
# </OpenUpgrade>
```
2 changes: 2 additions & 0 deletions openupgrade_framework/readme/INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module does not need to be installed on a database. It simply needs
to be available via your `addons-path`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
env.ref('auth_signup.reset_password_email').unlink()
120 changes: 60 additions & 60 deletions openupgrade_scripts/scripts/product/17.0.1.2/upgrade_analysis.txt
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
---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]
---Fields in module 'product'---
product / product.attribute / display_type (selection) : selection_keys is now '['color', 'multi', 'pills', 'radio', 'select']' ('['color', 'pills', 'radio', 'select']')
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
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
product / product.packaging / product_id (many2one) : now required
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
product / product.pricelist.item / active (boolean) : DEL
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
product / product.supplierinfo / discount (float) : NEW
product / product.tag / color (integer) : type is now 'char' ('integer')
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
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
---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
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
DEL ir.ui.view: product.report_producttemplatelabel
DEL product.pricelist: product.list0 (noupdate)
---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]
---Fields in module 'product'---
product / product.attribute / display_type (selection) : selection_keys is now '['color', 'multi', 'pills', 'radio', 'select']' ('['color', 'pills', 'radio', 'select']')
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
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
product / product.packaging / product_id (many2one) : now required
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
product / product.pricelist.item / active (boolean) : DEL
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
product / product.supplierinfo / discount (float) : NEW
product / product.tag / color (integer) : type is now 'char' ('integer')
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
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
---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
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
DEL ir.ui.view: product.report_producttemplatelabel
DEL product.pricelist: product.list0 (noupdate)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2023 Odoo Community Association (OCA)
# Copyright 2023 Shanghai Yumtown <[email protected]>
# 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, "sale_project", "17.0.1.2/noupdate_changes.xml")

0 comments on commit c973596

Please sign in to comment.