Skip to content

[19.0][MIG] database_size: Migration to 19.0#3632

Open
dnplkndll wants to merge 10 commits into
OCA:19.0from
ledoent:19.0-mig-database_size
Open

[19.0][MIG] database_size: Migration to 19.0#3632
dnplkndll wants to merge 10 commits into
OCA:19.0from
ledoent:19.0-mig-database_size

Conversation

@dnplkndll

Copy link
Copy Markdown
Contributor

Port of database_size from 18.0 to 19.0 (migration guide).

Non-mechanical adaptations worth flagging

  • read_group override → _read_group: 19.0 deprecated the public read_group (would fail checklog) and the web client no longer routes group views through it, so the old override was both noisy and dead. Re-implemented on the non-deprecated _read_group with the 19.0 signature (groupby/aggregates/having/order); it still just defaults the group order for the size-report views.
  • _sql_constraintsmodels.Constraint (kept the uniq_model_measurement_date name).
  • _compute_model_name: justified # pylint: disable=no-search-all on the ir.model load (small registry table; new 19.0 pylint-odoo check). The information_schema references are raw table-size SQL, unrelated to translatable-field jsonb assumptions.

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

Thank you. Can I ask why the commits don't reflect the history of the module in 18.0? https://github.com/OCA/server-tools/commits/18.0/database_size

@StefanRijnhart

Copy link
Copy Markdown
Member

/ocabot migration database_size

@OCA-git-bot OCA-git-bot added this to the 19.0 milestone Jun 29, 2026
@OCA-git-bot OCA-git-bot mentioned this pull request Jun 29, 2026
43 tasks
@StefanRijnhart

Copy link
Copy Markdown
Member

@FREDDYGAMBOABEDOR I don't think @dnplkndll needs you to burn tokens to explain the OCA processes. The original PR comment above links to the source of your walkthrough (and referring to that link is all that your comment should have done in the first place)

StefanRijnhart and others added 8 commits June 29, 2026 15:15
Currently translated at 100.0% (68 of 68 strings)

Translation: server-tools-18.0/server-tools-18.0-database_size
Translate-URL: https://translation.odoo-community.org/projects/server-tools-18-0/server-tools-18-0-database_size/it/
Currently translated at 100.0% (68 of 68 strings)

Translation: server-tools-18.0/server-tools-18.0-database_size
Translate-URL: https://translation.odoo-community.org/projects/server-tools-18-0/server-tools-18-0-database_size/it/
Fixes

```
  File "/home/odoo/.local/lib/python3.12/site-packages/sentry_sdk/client.py", line 595, in _prepare_event
    new_event = before_send(event, hint or {})
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/user/oca-server-tools/sentry/hooks.py", line 66, in before_send
    if event.setdefault("tags", {})["include_context"]:
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
KeyError: 'include_context'
2025-07-08 14:45:45,907 14296 INFO quatra-18-0-development-21441249 sentry_sdk.errors: before send dropped event
```

Error is only logged when running Sentry in debug mode, otherwise events are dropped silently.
Though TransactionCase rolls back database changes, it does not
call `unlink` on `auditlog.rule` records, meaning that `unsubscribe`
is never called to unpatch model methods. This causes subsequent
tests in other modules to unexpectedly execute patched methods.

This commit adds the `AuditLogRuleCommon` test class in an
attempt to identify and prevent patched methods from contaminating
the test environment.
Currently translated at 13.2% (9 of 68 strings)

Translation: server-tools-18.0/server-tools-18.0-database_size
Translate-URL: https://translation.odoo-community.org/projects/server-tools-18-0/server-tools-18-0-database_size/fr/
@dnplkndll dnplkndll force-pushed the 19.0-mig-database_size branch from e562fc7 to fdbc49a Compare June 29, 2026 23:13
@dnplkndll

Copy link
Copy Markdown
Contributor Author

Thank you. Can I ask why the commits don't reflect the history of the module in 18.0? https://github.com/OCA/server-tools/commits/18.0/database_size

sorry my bot squash script was not right back then. looks good now the diff just seems to be 19.0 rebase activity.

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

Code looks good. Data gathering seems to work well. I did find a reporting issue:

return self, new_domain

@api.model
def _where_calc(self, domain, active_test=True):

@StefanRijnhart StefanRijnhart Jul 1, 2026

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.

This method no longer exists. When opening the comparison menu and selecting a measurement date and/or a historic measurement date (for which there is data available), _table_query will still provide the default contents because these dates have not been inserted in the context. The domain will still filter out the selected dates, so if these are not the defaults the result is an empty list.

This also implies a lack of test coverage (mea culpa).

Data setup:

Image

Report selection:

Image

Snippet from the query returned by _table_query using the selection above:

select '2026-07-01'::date as measurement_date,
    '2026-06-29'::date as historical_measurement_date,
...
from ir_model_size cur
left join ir_model_size hst
    on cur.model = hst.model
       and hst.measurement_date = '2026-06-29'::date
where cur.measurement_date = '2026-07-01'::date

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants