diff --git a/odoo_module_migrate/migration_scripts/migrate_170_180.py b/odoo_module_migrate/migration_scripts/migrate_170_180.py index 8734fa08..3eeb75af 100644 --- a/odoo_module_migrate/migration_scripts/migrate_170_180.py +++ b/odoo_module_migrate/migration_scripts/migrate_170_180.py @@ -100,9 +100,30 @@ def replace_user_has_groups( logger.error(f"Error processing file {file}: {str(e)}") +def replace_editable_attribute( + logger, module_path, module_name, manifest_path, migration_steps, tools +): + files_to_process = tools.get_files(module_path, (".xml", ".js", ".py")) + replaces = { + 'editable="1"': 'editable="bottom"', + "editable='1'": 'editable="bottom"', + r'1': 'bottom', + } + for file in files_to_process: + try: + tools._replace_in_file( + file, + replaces, + log_message=f"""Replace editable="1" by "bottom" in file: {file}""", + ) + except Exception as e: + logger.error(f"Error processing file {file}: {str(e)}") + + class MigrationScript(BaseMigrationScript): _GLOBAL_FUNCTIONS = [ replace_tree_with_list_in_views, replace_chatter_blocks, replace_user_has_groups, + replace_editable_attribute, ] diff --git a/tests/data_result/module_170_180/__manifest__.py b/tests/data_result/module_170_180/__manifest__.py index 4599a7e8..c4ee8332 100644 --- a/tests/data_result/module_170_180/__manifest__.py +++ b/tests/data_result/module_170_180/__manifest__.py @@ -10,5 +10,6 @@ ], 'data': [ 'views/res_partner.xml', + 'views/product_template_view.xml', ], } diff --git a/tests/data_result/module_170_180/views/product_template_view.xml b/tests/data_result/module_170_180/views/product_template_view.xml new file mode 100644 index 00000000..5a2db6e6 --- /dev/null +++ b/tests/data_result/module_170_180/views/product_template_view.xml @@ -0,0 +1,15 @@ + + + + + product.template.list.custom + product.template + + + + + + + + + diff --git a/tests/data_result/module_170_180/views/res_partner.xml b/tests/data_result/module_170_180/views/res_partner.xml index ff22ea0c..f68d2593 100644 --- a/tests/data_result/module_170_180/views/res_partner.xml +++ b/tests/data_result/module_170_180/views/res_partner.xml @@ -8,6 +8,9 @@ + + bottom + diff --git a/tests/data_template/module_170/__manifest__.py b/tests/data_template/module_170/__manifest__.py index 4bee0f35..04016eb4 100644 --- a/tests/data_template/module_170/__manifest__.py +++ b/tests/data_template/module_170/__manifest__.py @@ -10,5 +10,6 @@ ], 'data': [ 'views/res_partner.xml', + 'views/product_template_view.xml', ], } diff --git a/tests/data_template/module_170/views/product_template_view.xml b/tests/data_template/module_170/views/product_template_view.xml new file mode 100644 index 00000000..784bbf52 --- /dev/null +++ b/tests/data_template/module_170/views/product_template_view.xml @@ -0,0 +1,15 @@ + + + + + product.template.list.custom + product.template + + + + + + + + + diff --git a/tests/data_template/module_170/views/res_partner.xml b/tests/data_template/module_170/views/res_partner.xml index 9beaf9b9..95bbc54f 100644 --- a/tests/data_template/module_170/views/res_partner.xml +++ b/tests/data_template/module_170/views/res_partner.xml @@ -8,6 +8,9 @@ + + 1 +