Skip to content

[19.0][MIG] auditlog: Migration to 19.0 - #3391

Closed
lembregtse wants to merge 191 commits into
OCA:19.0from
dynapps:19.0-mig-auditlog
Closed

[19.0][MIG] auditlog: Migration to 19.0#3391
lembregtse wants to merge 191 commits into
OCA:19.0from
dynapps:19.0-mig-auditlog

Conversation

@lembregtse

Copy link
Copy Markdown
Contributor

No description provided.

sebalix and others added 30 commits September 24, 2025 13:31
…itlog.log' model (standard 'create_date' field is used instead)
…ail data - if any - are migrated during the installation)
… 'field_description' fields changed into related fields
lembregtse and others added 12 commits September 24, 2025 13:31
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/
[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/
@rven

rven commented Sep 25, 2025

Copy link
Copy Markdown
Contributor

@legalsylvain It seems that the CI pipelines need to include the --with-demo option.
Odoo doesn't install demo by default anymore.

Comment thread auditlog/models/http_request.py Outdated
vals = {
"name": httprequest.path,
"root_url": httprequest.url_root,
"user_id": request.uid,

Copy link
Copy Markdown

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.

Comment thread 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,

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Contributor

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

@rven
rven force-pushed the 19.0-mig-auditlog branch from 715e3aa to 628c510 Compare October 9, 2025 13:22
@rven
rven force-pushed the 19.0-mig-auditlog branch from 628c510 to acf373c Compare October 9, 2025 13:24
@rven

rven commented Oct 9, 2025

Copy link
Copy Markdown
Contributor

@legalsylvain It seems that the CI pipelines need to include the --with-demo option. Odoo doesn't install demo by default anymore.

Fixed!

@rven rven mentioned this pull request Oct 9, 2025
43 tasks
@sbidoul

sbidoul commented Oct 11, 2025

Copy link
Copy Markdown
Member

/ocabot migration auditlog

@OCA-git-bot OCA-git-bot added this to the 19.0 milestone Oct 11, 2025

@DucTruongKomit DucTruongKomit left a comment

Copy link
Copy Markdown

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(

Copy link
Copy Markdown

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.

Comment thread auditlog/models/log.py
Comment on lines +47 to +48
if "model_id" in vals:
if not vals["model_id"]:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
if "model_id" in vals:
if not vals["model_id"]:
if "model_id" in vals and not vals["model_id"]:

Comment thread auditlog/models/log.py
_description = "Auditlog - Log details (fields updated)"

field_id = fields.Many2one(
"ir.model.fields", ondelete="set null", string="Field", index=True

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
"ir.model.fields", ondelete="set null", string="Field", index=True
"ir.model.fields", ondelete="set null", index=True

Comment thread auditlog/models/log.py
"ir.model.fields", ondelete="set null", string="Field", index=True
)
log_id = fields.Many2one(
"auditlog.log", string="Log", ondelete="cascade", index=True

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
"auditlog.log", string="Log", ondelete="cascade", index=True
"auditlog.log", ondelete="cascade", index=True

Comment thread auditlog/models/log.py
Comment on lines +98 to +99
if "field_id" in vals:
if not vals["field_id"]:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
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(

Copy link
Copy Markdown

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 StefanRijnhart left a comment

Copy link
Copy Markdown
Member

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.

@adnankkapasi

Copy link
Copy Markdown

@lembregtse Could you please do the needful, so that this PR gets merged?
Thanks in advance

@adnankkapasi

Copy link
Copy Markdown

@lembregtse Could you please do the needful, so that this PR gets merged? Thanks in advance

@lembregtse Any update?

@StefanRijnhart

StefanRijnhart commented Jan 2, 2026

Copy link
Copy Markdown
Member

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.

@StefanRijnhart

Copy link
Copy Markdown
Member

Superseded by #3483

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.