-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[19.0][MIG] auditlog: Migration to 19.0 #3391
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
Conversation
… ones to make overridding easier
…itlog.log' model (standard 'create_date' field is used instead)
…S.txt file removed
…ail data - if any - are migrated during the installation)
… a field is deleted (e.g. migration)
… 'field_description' fields changed into related fields
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: server-tools-18.0/server-tools-18.0-auditlog Translate-URL: https://translation.odoo-community.org/projects/server-tools-18-0/server-tools-18-0-auditlog/
Currently translated at 97.7% (85 of 87 strings) Translation: server-tools-18.0/server-tools-18.0-auditlog Translate-URL: https://translation.odoo-community.org/projects/server-tools-18-0/server-tools-18-0-auditlog/tr/
…ecuted by an onchange function
[IMP] auditlog: Add name to action for UX
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: server-tools-18.0/server-tools-18.0-auditlog Translate-URL: https://translation.odoo-community.org/projects/server-tools-18-0/server-tools-18-0-auditlog/
Currently translated at 100.0% (91 of 91 strings) Translation: server-tools-18.0/server-tools-18.0-auditlog Translate-URL: https://translation.odoo-community.org/projects/server-tools-18-0/server-tools-18-0-auditlog/it/
19601ca to
715e3aa
Compare
|
@legalsylvain It seems that the CI pipelines need to include the |
auditlog/models/http_request.py
Outdated
| vals = { | ||
| "name": httprequest.path, | ||
| "root_url": httprequest.url_root, | ||
| "user_id": request.uid, |
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.
This will trigger a warning: DeprecationWarning: Since 19.0, use request.env.uid directly
There may be more instances of this, I did not check.
auditlog/models/http_request.py
Outdated
| "root_url": httprequest.url_root, | ||
| "user_id": request.uid, | ||
| "http_session_id": http_session_model.current_http_session(), | ||
| "user_context": request.context, |
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.
This will trigger a warning: DeprecationWarning: Since 19.0, use request.env.context directly
There may be more instances of this, I did not check.
For request, this also applies to request.cr -> request.env.cr
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.
Fixed + added some test scenario's
715e3aa to
628c510
Compare
628c510 to
acf373c
Compare
Fixed! |
|
/ocabot migration auditlog |
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.
Could you help to solve, so it can be merged, please? @lembregtse
Thank you
| return False | ||
| httpsession = request.session | ||
| if httpsession: | ||
| existing_session = self.search( |
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 suggest we can use search_fetch which is available in odoo 18 to improve the perfomance.
| if "model_id" in vals: | ||
| if not vals["model_id"]: |
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.
| if "model_id" in vals: | |
| if not vals["model_id"]: | |
| if "model_id" in vals and not vals["model_id"]: |
| _description = "Auditlog - Log details (fields updated)" | ||
|
|
||
| field_id = fields.Many2one( | ||
| "ir.model.fields", ondelete="set null", string="Field", index=True |
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.
| "ir.model.fields", ondelete="set null", string="Field", index=True | |
| "ir.model.fields", ondelete="set null", index=True |
| "ir.model.fields", ondelete="set null", string="Field", index=True | ||
| ) | ||
| log_id = fields.Many2one( | ||
| "auditlog.log", string="Log", ondelete="cascade", index=True |
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.
| "auditlog.log", string="Log", ondelete="cascade", index=True | |
| "auditlog.log", ondelete="cascade", index=True |
| if "field_id" in vals: | ||
| if not vals["field_id"]: |
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.
| if "field_id" in vals: | |
| if not vals["field_id"]: | |
| if "field_id" in vals and not vals["field_id"]: |
| deadline = datetime.now() - timedelta(days=days) | ||
| data_models = ("auditlog.log", "auditlog.http.request", "auditlog.http.session") | ||
| for data_model in data_models: | ||
| records = self.env[data_model].search( |
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 same comment above using search_fetch
StefanRijnhart
left a comment
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.
Can you rebase? There has been quite some changes in this module during and after the OCA days this year.
Also, if you are interested in this module, maybe you would like to review of some of the other (unmerged) recent PRs against this module.
|
@lembregtse Could you please do the needful, so that this PR gets merged? |
@lembregtse Any update? |
|
Given that my recent changes in auditlog (not yet included here) are meddling with Odoo cache internals, which have been refactored completely in Odoo 19, I will be having a go at this one in the next couple of days. |
|
Superseded by #3483 |
No description provided.