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

[IMP] rename_fields : rename field also on custom view like the one used on dashboards #298

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

duong77476-viindoo
Copy link
Contributor

@duong77476-viindoo duong77476-viindoo commented Jul 15, 2022

close #190

@duong77476-viindoo duong77476-viindoo changed the title [IMP] rename_field : rename field also on custom view like the one used dashboards [IMP] rename_field : rename field also on custom view like the one used on dashboards Jul 15, 2022
@duong77476-viindoo duong77476-viindoo changed the title [IMP] rename_field : rename field also on custom view like the one used on dashboards [IMP] rename_fields : rename field also on custom view like the one used on dashboards Jul 15, 2022
@duong77476-viindoo
Copy link
Contributor Author

duong77476-viindoo commented Jul 15, 2022

Hmm, why it said key error? Something is not right

@pedrobaeza
Copy link
Member

ir.ui.view.custom may not exists for <=v9

@duong77476-viindoo duong77476-viindoo force-pushed the imp_rename_field branch 3 times, most recently from 9bd2dc3 to f659e7d Compare July 15, 2022 09:52
@duong77476-viindoo
Copy link
Contributor Author

duong77476-viindoo commented Jul 15, 2022

I haved test 2 cases where we gonna use rename_fields function

Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

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

I doubt this is going to be performant enough

@@ -582,6 +583,65 @@ def rename_columns(cr, column_spec):
)


def rename_field_on_dashboard(env, model, old_field, new_field):
Copy link
Member

Choose a reason for hiding this comment

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

This should be a private method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe you 're right

@pedrobaeza
Copy link
Member

What about performance?

@duong77476-viindoo duong77476-viindoo force-pushed the imp_rename_field branch 2 times, most recently from 93acdbc to d2e297c Compare July 17, 2022 11:05
@duong77476-viindoo
Copy link
Contributor Author

What about performance?

I have a few changes, if you have time please review

@@ -582,6 +583,65 @@ def rename_columns(cr, column_spec):
)


def _rename_field_on_dashboard(env, model, old_field, new_field,
dashboard_view_data):
for r in dashboard_view_data:
Copy link
Member

Choose a reason for hiding this comment

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

Do the search here and only if the view contains old_field.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review and suggestion, I'm quite busy at the moment so i will comeback with this ASAP. In the meantime, feel free to add some modification to this PR, i don't mind.

Kind regard,

Copy link
Contributor

Choose a reason for hiding this comment

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

@pedrobaeza Forgive me, but is all you are suggesting is (in my simplistic ways)

if old_field not in r.arch:
    continue

Copy link
Member

Choose a reason for hiding this comment

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

More or less, for improving drastically the performance. The previous search shouldn't contain non matched results.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done i use ilike search for ir.ui.view.custom that contain the old_field , is that ok? , also i rename the method and handle some of your comment, please review if you have time

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

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

Pending the scope of the search for better performance

@duong77476-viindoo duong77476-viindoo force-pushed the imp_rename_field branch 2 times, most recently from 55648d9 to 60a1ba2 Compare August 8, 2023 04:53
@pedrobaeza
Copy link
Member

My fear on this is that it affects a lot the performance. Have you performed a migration with and without this and measure the time for both?

@duong77476-viindoo
Copy link
Contributor Author

My fear on this is that it affects a lot the performance. Have you performed a migration with and without this and measure the time for both?

I did, but i haven't measured only test the script (it still lacking some cases). Next time i will try to measure and let you know

@pedrobaeza
Copy link
Member

At the end, it's to see: before the change, the migration lasts 20 minutes; after the change, it lasts 21 minutes. That's acceptable. But if you check it and it takes 40 minutes, then the performance should be analyzed.

@duong77476-viindoo
Copy link
Contributor Author

At the end, it's to see: before the change, the migration lasts 20 minutes; after the change, it lasts 21 minutes. That's acceptable. But if you check it and it takes 40 minutes, then the performance should be analyzed.

Yes, understood, will keep that in mind

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.

rename_fields: Rename field also in customized views domain
6 participants