-
-
Notifications
You must be signed in to change notification settings - Fork 586
[18.0][MIG] base_tier_validation: Migration to 18.0 #992
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
[18.0][MIG] base_tier_validation: Migration to 18.0 #992
Conversation
Can you place your commits in a separate commit? |
hi @bosd, that commit fixed the icon bug, but i consider that fix as part of PR Migration (because old PR is not yet merged). and author of this PR (#990) also mentioned we have duplicated work, you can read the conversation here: xaviedoanhduy#1 (comment) |
Thanks for the clarification. I was getting a bit lost between the migration pr of this module. Side note, on this one codecov is red. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks for taking care of this!
There are a few things that need to be corrected, IMO.
Could you check my remarks? 🙏🏻
Thanks!
review_groups = self.env["tier.review"].read_group(domain, ["model"], ["model"]) | ||
for review_group in review_groups: | ||
model = review_group["model"] | ||
Model = self.env[model] | ||
reviews = self.env["tier.review"].search(review_group.get("__domain")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 tip: This could probably be improved by leveraging the private _read_group
method, and aggregating ['id:recordset']
, and thus not needing to do a search afterwards
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ivantodorovich Good spot. that was on my mind as well.
There are some more places in the code of this module where the orm is flooded by searches from within a for loop.
The _read_group
method was introduced in the orm in V17.
IMO that improvement could go into V17 and be forward ported here. Should not be blocking for this pr.
(But I've been told, there is even a more improved method in the V18 orm. But I don't know the details or have looked into that one.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think :recordset
was added in 18.0.
In 17.0 a similar thing can be accomplished with :array_agg
, and then browsing the list of ids.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, _read_group
and ir.recordset
already exist in version 17.0, see: odoo/odoo#110737
and by the way I also applied the above code improvement from your suggestion, thank @ivantodorovich
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xaviedoanhduy Thanks!
Actually there are still some places in the code where a search is performed inside a for loop.
(Bad practice for performance.)
https://github.com/OCA/server-ux/pull/992/files#diff-7cca2e2b43a392c79d13759687633b9d88cfe56e6c2238b762e2c8d461690607R123-R124
Maybe you can attend to this, or put it on the roadmap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, _read_group and ir.recordset already exist in version 17.0, see: odoo/odoo#110737
Oh, indeed. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hello, I've improved some search functions that are called in several loops into a separate commit
base_tier_validation/static/src/components/tier_review_widget/tier_review_widget.esm.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functional test looks good to me - no issues found
bc507f3
to
3108668
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your efforts and work on this: 👍
Functional test:
Colors are not showing in review bar as mentioned by @celm1990 in #990 (review)
3108668
to
60977bf
Compare
hi, color issue on reviewers list has been fixed. thanks for the tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/ocabot migration base_tier_validation |
9aedf95
to
e7545d3
Compare
hi @bosd, I'm not sure the error from your dev tool comes from this module. I also took this opportunity to improve the interface a bit. |
Thanks, If you want, you can include #991 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a minor change and let's go.
Additionally, please squash the administrative commits a bit. Thanks for the effort!
onToggleCollapse(ev) { | ||
const panelHeading = ev.currentTarget.closest(".panel-heading"); | ||
const collapseDiv = panelHeading.nextElementSibling.matches("div#collapse1") | ||
? panelHeading.nextElementSibling | ||
: null; | ||
if (!collapseDiv) return; | ||
this.state.collapse = !this.state.collapse; | ||
if (this.state.collapse) { | ||
collapseDiv.style.display = "none"; | ||
} else { | ||
collapseDiv.style.display = "block"; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first time you click the widget, it does not open; a second click is needed to collapse it. Please take a look. On the second attempt, it works fine, but if you refresh the view again, it doesn't work. I think the initial state might be related.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xaviedoanhduy could you please check this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @celm1990, in my country it is Lunar New Year. I will start working again on 02/03/2025. Thank you for raising the issue and btw happy Lunar New Year 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy lunar year! The year of intelligence and love
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e7545d3
to
a01b6d5
Compare
a01b6d5
to
4c6095b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, LGTM.
Just a non-blocking comment: I think it's possible to squash the administrative commits a bit, following this guide: Merge commits in pull requests.
Thanks for the effort!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks everyone, great work here on the review and the follow up!
/ocabot merge nobump |
On my way to merge this fine PR! |
@StefanRijnhart your merge command was aborted due to failed check(s), which you can inspect on this commit of 18.0-ocabot-merge-pr-992-by-StefanRijnhart-bump-nobump. After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red. |
Merge failed on OCA/oca-addons-repo-template#291. Doh! |
Let's try again after this hour long scheduled brownout /ocabot merge nobump |
This PR looks fantastic, let's merge it! |
Congratulations, your PR was merged at 7526531. Thanks a lot for contributing to OCA. ❤️ |
Thanks for the team work on this migration! Is any of you using this one already in production?
|
We are using this in production. We have noticed a few issues.
|
@miikanissi Thanks for the heads-up. It looks like there is not feedback from the migrator and reviewers in v18. If your comments are still applicable, I would kindly ask you to create issues in this repository to track the problem. Otherwise this comment will be forgotten here. |
supersedes: #966
changes are follow up from old PR:
TierReviewService
). don't use useState to calculate tierReviewCounter because the service will updateservices["mail.store"]
f-string
and placeholder formatting_read_group
for better performancet-esc
)