-
-
Notifications
You must be signed in to change notification settings - Fork 172
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
[IMP] openupgrade_160, openupgrade_tools: BS4 to BS5 transformation yeahhhhh #338
[IMP] openupgrade_160, openupgrade_tools: BS4 to BS5 transformation yeahhhhh #338
Conversation
|
||
# These replacements are from standard Bootstrap 4 to 5 | ||
_BS5_REPLACEMENTS = ( | ||
# Grid stuff |
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.
The comment i use here following the same order in https://getbootstrap.com/docs/5.1/migration
33f9e1e
to
aa7482f
Compare
Yeahhhhh! |
I have tested with PR OCA/OpenUpgrade#3949 , seem work fine, not sure i miss any thing or not :v |
af4e05a
to
3346708
Compare
@@ -104,6 +104,7 @@ def convert_xml_node( | |||
style_rm=frozenset(), | |||
tag="", | |||
wrap="", | |||
attr_rp=None, |
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.
Here i added anaother option to allow attribute replacement, put it in the last to avoid error
def replace_html_replacement_attr_shortcut(attr_rp="", **kwargs): | ||
"""Shortcut to replace an attribute spec. | ||
|
||
:param dict attr_rp: | ||
EX: {'data-toggle': 'data-bs-toggle'} | ||
Where the 'key' is the attribute will be replaced by the 'value' |
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.
Also define a shortcut for it
3346708
to
011d131
Compare
011d131
to
529ba55
Compare
734ec28
to
a1759d0
Compare
41799ce
to
5269546
Compare
text-justify removed
5269546
to
4fd0cb2
Compare
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.
Tested in local running the scripts manually to validate qweb views 👍
Thanks!
Thank you, although i think i might lack some cases, anyway it fine by me as i have already tested on a production database |
AsIs(field), | ||
new_content, | ||
id_, | ||
) |
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.
Is there a bug in the cr.execute() call, assuming syntax is cr.execute(query, params)?
I got the below error during migration which lead me here.
2023-11-11 15:54:29,149 58099 CRITICAL test odoo.service.server: Failed to initialize database `test`.
Traceback (most recent call last):
File "/Users/lijo/work/odoo16/odoo/service/server.py", line 1299, in preload_registries
registry = Registry.new(dbname, update_module=update_module)
File "<decorator-gen-16>", line 2, in new
File "/Users/lijo/work/odoo16/odoo/tools/func.py", line 87, in locked
return func(inst, *args, **kwargs)
File "/Users/lijo/work/odoo16/odoo/modules/registry.py", line 90, in new
odoo.modules.load_modules(registry, force_demo, status, update_module)
File "/Users/lijo/work/odoo16/odoo/modules/loading.py", line 523, in load_modules
migrations.migrate_module(package, 'end')
File "/Users/lijo/work/oca/OpenUpgrade/openupgrade_framework/odoo_patch/odoo/modules/migration.py", line 18, in migrate_module
MigrationManager.migrate_module._original_method(self, pkg, stage)
File "/Users/lijo/work/odoo16/odoo/modules/migration.py", line 189, in migrate_module
migrate(self.cr, installed_version)
File "/Users/lijo/miniforge3/envs/odoo16/lib/python3.8/site-packages/openupgradelib/openupgrade.py", line 2277, in wrapped_function
func(
File "/Users/lijo/work/oca/OpenUpgrade/openupgrade_scripts/scripts/website/16.0.1.0/end-migration.py", line 81, in migrate
convert_custom_qweb_templates_bootstrap_4to5(env)
File "/Users/lijo/work/oca/OpenUpgrade/openupgrade_scripts/scripts/website/16.0.1.0/end-migration.py", line 26, in convert_custom_qweb_templates_bootstrap_4to5
_convert_field_bootstrap_4to5_sql(env.cr, "ir_ui_view", "arch_db", ids=view_ids)
File "/Users/lijo/miniforge3/envs/odoo16/lib/python3.8/site-packages/openupgradelib/openupgrade_160.py", line 397, in _convert_field_bootstrap_4to5_sql
cr.execute(
TypeError: execute() takes from 2 to 4 positional arguments but 6 were given
Changing the execute call as below seems to fix it
cr.execute(
"UPDATE %s SET %s = %s WHERE id = %s",
(AsIs(table), AsIs(field), new_content, id_),
)
Is my understanding wrong?
BS4 to BS5 transformation yeahhhhh