OCA / odoo-module-migrator

Python library to migrate odoo base code from a version to another
GNU Affero General Public License v3.0
131 stars 119 forks source link

Refactoring: Scripts converted into classes #30

Open flachica opened 4 years ago

flachica commented 4 years ago

In this PR I propossed the refactoring to

* Module script is converted to instance of class
* It is easy to convert, only need move the current content of script to __init__ class
* All script have the run base function that operates with protected properties _TEXT_REPLACES, ERRORS, ETC. `def run(self, module_path, manifest_path, module_name, migration_steps, directory_path, commit_enabled)`
* Also have `def process_file(self, root, filename, extension, file_renames, directory_path, commit_enabled)` to process file one by one
* If a script fail you can know so easy. Only need review the stack trace.
* On this refactoring you could delete global functions. Only you need inherit run method and overwrite it
* I have maintain global_funtions

Since I intend to continue working on the tool and I prefer that the author give me his opinion, I am going to keep a branch in my fork and I will continue doing PR in the master of this repository. I await the code review. If they give me OK, when the time comes I will do a PR with the refactoring

flachica commented 4 years ago

Can someone review this refactoring? On my fork, in the flachica_features branch, I made some changes that I think may be interesting.

Refactoring is totally optional but I found it useful. Also, on my branch I included those commits that the author could not review due to work overload

@ivantodorovich

ivantodorovich commented 4 years ago

Hi @flachica ,

Sure, that PR is closed though. Can you reopen it and possibly rebase it?

flachica commented 4 years ago

Many thanks. PR Opened, If you see it clearly, you could clean the history once the work is validated. @ivantodorovich