-
-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] replace toggle_button to boolean_toggle widget
- Loading branch information
1 parent
38e7a02
commit cf6533c
Showing
5 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
odoo_module_migrate/migration_scripts/migrate_150_allways.py
This file contains 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,28 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo_module_migrate.base_migration_script import BaseMigrationScript | ||
|
||
|
||
def replace_toggle_button( | ||
logger, module_path, module_name, manifest_path, migration_steps, tools | ||
): | ||
files_to_process = tools.get_files(module_path, (".xml",)) | ||
replaces = { | ||
r'widget="\s*toggle_button\s*"': 'widget="boolean_toggle"', | ||
r"widget='\s*toggle_button\s*'": 'widget="boolean_toggle"', | ||
r'<attribute\s+name=["\']widget["\']>\s*toggle_button\s*</attribute>': '<attribute name="widget">boolean_toggle</attribute>', | ||
} | ||
|
||
for file in files_to_process: | ||
try: | ||
tools._replace_in_file( | ||
file, | ||
replaces, | ||
log_message=f"Replace toggle_button widget to boolean_toggle widget in file: {file}", | ||
) | ||
except Exception as e: | ||
logger.error(f"Error processing file {file}: {str(e)}") | ||
|
||
|
||
class MigrationScript(BaseMigrationScript): | ||
_GLOBAL_FUNCTIONS = [replace_toggle_button] |
This file contains 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
This file contains 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
This file contains 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
This file contains 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