Skip to content
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

[17.0][OU-ADD] openupgrade_framework: framework patches #4327

Closed
wants to merge 42 commits into from

Conversation

acpMicrocom
Copy link
Contributor

No description provided.

Copy link
Contributor

@legalsylvain legalsylvain left a comment

Choose a reason for hiding this comment

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

Hi @acpMicrocom

Thanks a lot for working on openupgrade V17.
Could you preserve git history, cherry picking previous commit present in V16 ?

  • it respects authors and history
  • it makes easier the diff review between 16.0 and 17.0

see : https://github.com/OCA/maintainer-tools/wiki/Migration-to-version-17.0#technical-method-to-migrate-a-module-from-160-to-170-branch

Thanks !

/ocabot migration openupgrade_framework

@OCA-git-bot OCA-git-bot added this to the 17.0 milestone Feb 28, 2024
@OCA-git-bot OCA-git-bot mentioned this pull request Feb 28, 2024
4 tasks
@acpMicrocom
Copy link
Contributor Author

Ok Thanks !

legalsylvain and others added 26 commits February 28, 2024 16:27
If we don't include it, /jsonrpc route doesn't work.
If you have a module in previous versions that adds data on a model,
and such model is not loaded in the registry in current version because
the module is absent in it, you can't uninstall such module, getting
this error:

  File "odoo/odoo/addons/base/models/ir_model.py", line 1945, in _module_data_uninstall
    delete(self.env[model].browse(item[1] for item in items))
  File "odoo/odoo/api.py", line 463, in __getitem__
    return self.registry[model_name]._browse(self, (), ())
  File "odoo/odoo/modules/registry.py", line 177, in __getitem__
    return self.models[model_name]
KeyError: 'model'

With this patch, data cleanup of such model is skipped and there's no crash.
…ore ; add links to the new OpenUpgrade website
If corresponding field is None, we need to avoid the "AttributeError: 'NoneType' object has no attribute error.
…e useless after the input argument validate has been removed
Copy link
Contributor

@legalsylvain legalsylvain left a comment

Choose a reason for hiding this comment

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

thanks !

@pedrobaeza
Copy link
Member

@legalsylvain have you checked that each patch method is still the same? It's for not doing 2 times the same work.

@legalsylvain
Copy link
Contributor

@legalsylvain have you checked that each patch method is still the same? It's for not doing 2 times the same work.

I just check that the function still exists, with the same arguments list.

xtanuiha pushed a commit to xtanuiha/OpenUpgrade that referenced this pull request Mar 27, 2024
@api.model
def _process_end(self, modules):
"""Don't warn about upgrade conventions from Odoo
('fields should be explicitly removed by an upgrade script')
Copy link
Member

Choose a reason for hiding this comment

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

Warning was removed from Odoo in odoo/odoo#56657
This patch can be removed here.

def _get_tests_modules(mod):
"""
Make odoo load tests from openupgrade_scripts/scripts/$module/$version/tests
instead of the standard location
Copy link
Member

Choose a reason for hiding this comment

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

It looks like https://github.com/odoo/odoo/blob/8c62f4a/odoo/tests/loader.py#L38-L57 makes it possible to load tests from upgrade paths, which is also the aim of this patch. Do you agree @hbrunn?

Copy link
Member

Choose a reason for hiding this comment

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

Played around with this a bit, and I got it to load a test from the --upgrade-path (subpath base/tests/test_migration_test.py). Because it has a module path in odoo.upgrade instead of odoo.addons it does not get assigned the expected attributes in https://github.com/odoo/odoo/blob/aa84ccf/odoo/tests/common.py#L222-L227. The attributes therefore have to be assigned manually:

from odoo.tests import tagged, TransactionCase


@tagged("at_install", "openupgrade")
class TestMigrationTest(TransactionCase):
    def test_migration_test(self):
        self.assertEqual(1, 0)

TestMigrationTest.test_module = "base"
TestMigrationTest.test_class = "TestMigrationTest"
TestMigrationTest.test_sequence = 0

After that, the test runs fine and can be selected with test tags base:TestMigrationTest or openupgrade.

Personally, I think that is acceptable given that tests are still very much underused and not for the faint of heart at this point.

Copy link
Member

Choose a reason for hiding this comment

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

agreed the patch becomes obsolete in v17. We could provide a base class for running openupgrade tests, but that's for another PR

@@ -0,0 +1,4 @@
Many developers have contributed to the OpenUpgrade framework in its
previous incarnation. Their original contributions may no longer needed,
Copy link
Member

@rvalyi rvalyi Apr 1, 2024

Choose a reason for hiding this comment

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

s/may no longer needed/may no longer be needed/

Copy link
Contributor

Choose a reason for hiding this comment

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

hi @rvalyi. I think you can use the "propose change" github feature. It is more readable than the regex syntax ! (and can be approved if desired).
thanks !

Copy link
Member

Choose a reason for hiding this comment

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

are you sure it can be used? It adds extra commits noise that many dislike. I don't see the feature used anymore in the OCA. Can you confirm it's easy enough to remove the commit noise vs doing it this way?

Copy link
Member

Choose a reason for hiding this comment

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

I don't use the github feature for committing myself, because indeed it creates extra commits I'd have to squash again. But still I appreciate reviewers using the feature, because that makes it perfectly clear what they mean.

Copy link
Contributor

Choose a reason for hiding this comment

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

But still I appreciate reviewers using the feature, because that makes it perfectly clear what they mean.

👍 That is my point. Regex expression is not very easy to read.

I don't use the github feature for committing myself, because indeed it creates extra commits I'd have to squash again

Matter of taste. Once the change proposal is done you can :

  • merge then squash
  • or make changes locally and push

@pedrobaeza pedrobaeza changed the title [OU-ADD] openupgrade_framework: framework patches [17.0][OU-ADD] openupgrade_framework: framework patches Apr 11, 2024
@StefanRijnhart
Copy link
Member

@iTecan There are no migration scripts yet for OpenUpgrade 17. These are only the supporting framework methods.

@StefanRijnhart
Copy link
Member

@acpMicrocom The pandoc-3.1.12.1-1-amd64.deb is an artifact of pre-commit initialization. Please remove it from this PR. Can you follow-up the other comments?

@MiquelRForgeFlow
Copy link
Contributor

@StefanRijnhart would you like to supersede this PR?

@StefanRijnhart
Copy link
Member

Superseded by #4427

duong77476-viindoo added a commit to royle-viindoo/OpenUpgrade that referenced this pull request May 23, 2024
-This commit remove unecessary patch
-Check if test exist then execute it in the test.yml
-Remove the test loader from patch, detail at
OCA#4327 (comment)
duong77476-viindoo added a commit to royle-viindoo/OpenUpgrade that referenced this pull request May 23, 2024
-This commit remove unecessary patch
-Check if test exist then execute it in the test.yml
-Remove the test loader from patch, detail at
OCA#4327 (comment)
xtanuiha pushed a commit to xtanuiha/OpenUpgrade that referenced this pull request May 30, 2024
xtanuiha pushed a commit to xtanuiha/OpenUpgrade that referenced this pull request May 30, 2024
parent c973596
author 张飞虎 <feihu.zhang@yumtown.com.cn> 1711431231 +0000
committer 张飞虎 <feihu.zhang@yumtown.com.cn> 1717058855 +0000

# This is a combination of 2 commits.
# This is the 1st commit message:

parent c973596
author 张飞虎 <feihu.zhang@yumtown.com.cn> 1711431231 +0000
committer 张飞虎 <feihu.zhang@yumtown.com.cn> 1717058818 +0000

添加openupgrade_framework代码OCA#4327

增加upgrade_anaylysis_work.txt

init base migration script

初步完成base模块的升级脚本

初步添加account模块升级脚本

修复文件名错误

BUG Fix

增加mail模块升级脚本

完成mail升级脚本

初步添加hr升级脚本

完成hr模块升级脚本

# This is the commit message OCA#2:

完成account模块升级脚本

# This is the commit message OCA#3:

更新模块清单

# This is the commit message OCA#4:

添加sale_management升级脚本

# This is the commit message OCA#5:

修复升级问题

# This is the commit message OCA#6:

完善project模块升级脚本

# This is the commit message OCA#7:

增加一堆模块no_update的处理

# This is the commit message OCA#8:

BUG Fix

# This is the commit message OCA#9:

暂时移除delivery升级脚本

# This is the commit message OCA#10:

改进项目升级脚本

# This is the commit message OCA#11:

添加针对hr_responsible_id字段的处理

# This is the commit message OCA#12:

增加auth_signup升级脚本

# This is the commit message OCA#13:

修复mail_alias上的mail_channel数据
xtanuiha pushed a commit to xtanuiha/OpenUpgrade that referenced this pull request May 30, 2024
parent c973596
author 张飞虎 <feihu.zhang@yumtown.com.cn> 1711431231 +0000
committer 张飞虎 <feihu.zhang@yumtown.com.cn> 1717058855 +0000

parent c973596
author 张飞虎 <feihu.zhang@yumtown.com.cn> 1711431231 +0000
committer 张飞虎 <feihu.zhang@yumtown.com.cn> 1717058818 +0000

添加openupgrade_framework代码OCA#4327

增加upgrade_anaylysis_work.txt

init base migration script

初步完成base模块的升级脚本

初步添加account模块升级脚本

修复文件名错误

BUG Fix

增加mail模块升级脚本

完成mail升级脚本

初步添加hr升级脚本

完成hr模块升级脚本

完成account模块升级脚本

更新模块清单

添加sale_management升级脚本

修复升级问题

完善project模块升级脚本

增加一堆模块no_update的处理

BUG Fix

暂时移除delivery升级脚本

改进项目升级脚本

添加针对hr_responsible_id字段的处理

增加auth_signup升级脚本

修复mail_alias上的mail_channel数据
xtanuiha pushed a commit to xtanuiha/OpenUpgrade that referenced this pull request May 30, 2024
parent c973596
author 张飞虎 <feihu.zhang@yumtown.com.cn> 1711431231 +0000
committer 张飞虎 <feihu.zhang@yumtown.com.cn> 1717058855 +0000

parent c973596
author 张飞虎 <feihu.zhang@yumtown.com.cn> 1711431231 +0000
committer 张飞虎 <feihu.zhang@yumtown.com.cn> 1717058818 +0000

添加openupgrade_framework代码OCA#4327

增加upgrade_anaylysis_work.txt

init base migration script

初步完成base模块的升级脚本

初步添加account模块升级脚本

修复文件名错误

BUG Fix

增加mail模块升级脚本

完成mail升级脚本

初步添加hr升级脚本

完成hr模块升级脚本

完成account模块升级脚本

更新模块清单

添加sale_management升级脚本

修复升级问题

完善project模块升级脚本

增加一堆模块no_update的处理

BUG Fix

暂时移除delivery升级脚本

改进项目升级脚本

添加针对hr_responsible_id字段的处理

增加auth_signup升级脚本

修复mail_alias上的mail_channel数据
xtanuiha pushed a commit to xtanuiha/OpenUpgrade that referenced this pull request May 30, 2024
parent c973596
author 张飞虎 <feihu.zhang@yumtown.com.cn> 1711431231 +0000
committer 张飞虎 <feihu.zhang@yumtown.com.cn> 1717058855 +0000

parent c973596
author 张飞虎 <feihu.zhang@yumtown.com.cn> 1711431231 +0000
committer 张飞虎 <feihu.zhang@yumtown.com.cn> 1717058818 +0000

添加openupgrade_framework代码OCA#4327

增加upgrade_anaylysis_work.txt

init base migration script

初步完成base模块的升级脚本

初步添加account模块升级脚本

修复文件名错误

BUG Fix

增加mail模块升级脚本

完成mail升级脚本

初步添加hr升级脚本

完成hr模块升级脚本

完成account模块升级脚本

更新模块清单

添加sale_management升级脚本

修复升级问题

完善project模块升级脚本

增加一堆模块no_update的处理

BUG Fix

暂时移除delivery升级脚本

改进项目升级脚本

添加针对hr_responsible_id字段的处理

增加auth_signup升级脚本

修复mail_alias上的mail_channel数据
xtanuiha pushed a commit to xtanuiha/OpenUpgrade that referenced this pull request May 30, 2024
parent c973596
author 张飞虎 <feihu.zhang@yumtown.com.cn> 1711431231 +0000
committer 张飞虎 <feihu.zhang@yumtown.com.cn> 1717058855 +0000

parent c973596
author 张飞虎 <feihu.zhang@yumtown.com.cn> 1711431231 +0000
committer 张飞虎 <feihu.zhang@yumtown.com.cn> 1717058818 +0000

添加openupgrade_framework代码OCA#4327

增加upgrade_anaylysis_work.txt

init base migration script

初步完成base模块的升级脚本

初步添加account模块升级脚本

修复文件名错误

BUG Fix

增加mail模块升级脚本

完成mail升级脚本

初步添加hr升级脚本

完成hr模块升级脚本

完成account模块升级脚本

更新模块清单

添加sale_management升级脚本

修复升级问题

完善project模块升级脚本

增加一堆模块no_update的处理

BUG Fix

暂时移除delivery升级脚本

改进项目升级脚本

添加针对hr_responsible_id字段的处理

增加auth_signup升级脚本

修复mail_alias上的mail_channel数据

添加openupgrade_framework代码OCA#4327

parent c973596
author 张飞虎 <feihu.zhang@yumtown.com.cn> 1711431231 +0000
committer 张飞虎 <feihu.zhang@yumtown.com.cn> 1717058855 +0000

parent c973596
author 张飞虎 <feihu.zhang@yumtown.com.cn> 1711431231 +0000
committer 张飞虎 <feihu.zhang@yumtown.com.cn> 1717058818 +0000

添加openupgrade_framework代码OCA#4327

增加upgrade_anaylysis_work.txt

init base migration script

初步完成base模块的升级脚本

初步添加account模块升级脚本

修复文件名错误

BUG Fix

增加mail模块升级脚本

完成mail升级脚本

初步添加hr升级脚本

完成hr模块升级脚本

完成account模块升级脚本

更新模块清单

添加sale_management升级脚本

修复升级问题

完善project模块升级脚本

增加一堆模块no_update的处理

BUG Fix

暂时移除delivery升级脚本

改进项目升级脚本

添加针对hr_responsible_id字段的处理

增加auth_signup升级脚本

修复mail_alias上的mail_channel数据
xtanuiha pushed a commit to xtanuiha/OpenUpgrade that referenced this pull request May 30, 2024
parent c973596
author 张飞虎 <feihu.zhang@yumtown.com.cn> 1711431231 +0000
committer 张飞虎 <feihu.zhang@yumtown.com.cn> 1717058855 +0000

parent c973596
author 张飞虎 <feihu.zhang@yumtown.com.cn> 1711431231 +0000
committer 张飞虎 <feihu.zhang@yumtown.com.cn> 1717058818 +0000

添加openupgrade_framework代码OCA#4327

增加upgrade_anaylysis_work.txt

init base migration script

初步完成base模块的升级脚本

初步添加account模块升级脚本

修复文件名错误

BUG Fix

增加mail模块升级脚本

完成mail升级脚本

初步添加hr升级脚本

完成hr模块升级脚本

完成account模块升级脚本

更新模块清单

添加sale_management升级脚本

修复升级问题

完善project模块升级脚本

增加一堆模块no_update的处理

BUG Fix

暂时移除delivery升级脚本

改进项目升级脚本

添加针对hr_responsible_id字段的处理

增加auth_signup升级脚本

修复mail_alias上的mail_channel数据

添加openupgrade_framework代码OCA#4327

parent c973596
author 张飞虎 <feihu.zhang@yumtown.com.cn> 1711431231 +0000
committer 张飞虎 <feihu.zhang@yumtown.com.cn> 1717058855 +0000

parent c973596
author 张飞虎 <feihu.zhang@yumtown.com.cn> 1711431231 +0000
committer 张飞虎 <feihu.zhang@yumtown.com.cn> 1717058818 +0000

添加openupgrade_framework代码OCA#4327

增加upgrade_anaylysis_work.txt

init base migration script

初步完成base模块的升级脚本

初步添加account模块升级脚本

修复文件名错误

BUG Fix

增加mail模块升级脚本

完成mail升级脚本

初步添加hr升级脚本

完成hr模块升级脚本

完成account模块升级脚本

更新模块清单

添加sale_management升级脚本

修复升级问题

完善project模块升级脚本

增加一堆模块no_update的处理

BUG Fix

暂时移除delivery升级脚本

改进项目升级脚本

添加针对hr_responsible_id字段的处理

增加auth_signup升级脚本

修复mail_alias上的mail_channel数据
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.

None yet

10 participants