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

[RFR] Improve patchwork #3

Conversation

StefanRijnhart
Copy link

@StefanRijnhart StefanRijnhart commented Nov 30, 2020

  • pinpointed patches needed to run the analysis and removed the rest
  • unified upgrade_loading and upgrade_log, taking only methods needed for the analysis
  • added some usability to the analysis wizards to use them with odoorpc

Copy link
Owner

@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.

Nice refactoring !

some questions inline. (no blocking point).

@@ -31,6 +33,10 @@ class UpgradeAnalysis(models.Model):
)

log = fields.Text(readonly=True)
upgrade_path = fields.Char(
default=config.get("upgrade_path", False),
Copy link
Owner

Choose a reason for hiding this comment

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

👍 for making it configurable.
(it is also more visible for the user).

Copy link
Author

Choose a reason for hiding this comment

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

Yes, as I needed this to set the path from XMLRPC.

pass
# </OpenUpgrade>

PosConfig.post_install_pos_localisation = post_install_pos_localisation
Copy link
Owner

Choose a reason for hiding this comment

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

do you think this patch is useless ?

Copy link
Author

Choose a reason for hiding this comment

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

Here again, I could reinstall all Odoo modules with this set of patches, so yes.

for id, xid, record, info in converted:
from odoo import api, models
from ..odoo_patch import OdooPatch
from ....upgrade_analysis import upgrade_log
Copy link
Owner

Choose a reason for hiding this comment

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

pythonic question :
I saw you replaced
from ... import upgrade_log
by
from ....upgrade_analysis import upgrade_log

is it a cosmectic change, or is it better for any reason ?

Copy link
Author

Choose a reason for hiding this comment

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

Oh, I'm just not used to relative imports. Your version works fine and is more direct so I reverted this line.

method_names = ['_convert_records']

@api.model
def _convert_records(self, records, log=lambda a: None):
Copy link
Owner

Choose a reason for hiding this comment

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

Huge simplification ! from 179 lines to 21 !

"yeld function" seem easier to patch. Very clean.

_logger = logging.getLogger(__name__)


class OdooPatch(object):
Copy link
Owner

Choose a reason for hiding this comment

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

Very elegant design. Thanks a lot !

Do you think it could be interesting to move this code in a standalone module odoo_patch ?

Copy link
Author

Choose a reason for hiding this comment

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

Well, the simplistic implementation currently requires that each collection of patches uses their own patch superclass so in the current form it does not make any sense.


class GenerateWizard(models.TransientModel):
_name = "upgrade.generate.record.wizard"
_description = "Upgrade Generate Record Wizard"

state = fields.Selection([("draft", "Draft"), ("done", "Done")], default="draft")

# from openupgradelib import openupgrade_tools
# TODO, SLG, make better a patch in odoo_patch
# def quirk_standard_calendar_attendances(self):
Copy link
Owner

Choose a reason for hiding this comment

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

this part is also obsolete in V14 ?

Copy link
Author

Choose a reason for hiding this comment

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

I could reinstall all Odoo modules with this set of patches, so yes.

@StefanRijnhart StefanRijnhart force-pushed the 14.0-ADD-upgrade_analysis branch from da596da to d6f8927 Compare December 1, 2020 09:42
@StefanRijnhart
Copy link
Author

Thanks for the quick and favorable review! I improved on the relative imports on your suggestion.

@legalsylvain legalsylvain merged commit f2298f1 into legalsylvain:14.0-ADD-upgrade_analysis Dec 1, 2020
@legalsylvain
Copy link
Owner

thanks !

legalsylvain pushed a commit that referenced this pull request Feb 19, 2024
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.

2 participants