Skip to content

Conversation

@diagnoza
Copy link
Contributor

@diagnoza diagnoza commented Dec 1, 2025

Add a new function that replaces util.add_to_migration_reports.

The new function can automatically parse the provided data as a list of records. It can also limit the number of displayed records to prevent the upgrade report from growing too large.

The structure of the note is now defined within the function itself, standardizing its appearance.

Example usage

More examples will follow in odoo/upgrade, replacing the existing use of util.add_to_migration_reports.

Example 1

cr.execute(
        """
        SELECT p.id, p.name, p.city, p.comment, p.company_id, com.name FROM res_partner p
          JOIN res_company com
            ON p.company_id = com.id
        """
    )

summary = """
    This is a test of the utility method that is displaying a list of rows
    returned by an SQL query. The number of displayed rows is limited.
    """
row_format = "Partner with id {partner_link} works at company {company_link} in {city}, ({comment})"
columns = ("id", "name", "city", "comment", "company_id", "company_name")
links = {"company_link": ("res.company", "company_id", "company_name"), "partner_link": ("res.partner", "id", "name")}
util.add_report(header="Test of the new utility method", summary=summary, row_format=row_format, columns=columns, links=links, data=cr.fetchall())
image

Example 2

util.add_report(header="Simple note", summary="A detailed description of the change.")
image

Example 3

msg = """
This is some text in **bold**.  

This is a line  
that should break.

- Item one
- Item two
    - Sub-item

And some _italic_ text.
"""
util.add_report(header="MD note", summary=msg, report_format="md")
image

Example 4

msg = """
This is some text in **bold**.

| This is a line
| that should break.

* Item one
* Item two

  * Sub-item

And some *italic* text.
"""
util.add_report(header="RST note", summary=msg, report_format="rst")
image

Remaining details to discuss

  1. The introduction of env var to control limit.
  2. Enforce/assert the use of tuples instead of lists. Currently, it's possible to pass a list for columns (instead of a tuple) or a dictionary of lists for links (instead of a dictionary of tuples).
  3. How to handle depreciation of add_to_migration_reports.
  4. Indentation of the ir.ui.view record corresponding to the note is sometimes incorrect (previously there was the same issue):
image

@diagnoza diagnoza requested review from a team and aj-fuentes December 1, 2025 07:19
@robodoo
Copy link
Contributor

robodoo commented Dec 1, 2025

Pull request status dashboard

@diagnoza diagnoza force-pushed the master-add_report-owi branch 7 times, most recently from cc49acd to 7dae849 Compare December 1, 2025 08:16
@KangOl
Copy link
Contributor

KangOl commented Dec 1, 2025

upgradeci retry with always only crm

Copy link
Contributor

@aj-fuentes aj-fuentes left a comment

Choose a reason for hiding this comment

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

I think we can do some simplification here. Some suggestions below. Note that none of the suggestions were tested, take it as a guide.

@diagnoza diagnoza force-pushed the master-add_report-owi branch 7 times, most recently from b40852a to 3525d5d Compare December 3, 2025 16:19
@diagnoza diagnoza requested review from KangOl and aj-fuentes December 3, 2025 16:19
@diagnoza diagnoza force-pushed the master-add_report-owi branch from 3525d5d to 7b3739f Compare December 3, 2025 16:21
Copy link
Contributor

@aj-fuentes aj-fuentes left a comment

Choose a reason for hiding this comment

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

Looks better. Please adapt the documentation to the same format we use elsewhere in this repo. Some suggestions above.

@diagnoza diagnoza force-pushed the master-add_report-owi branch 2 times, most recently from 99a9c5c to c48c6f9 Compare December 8, 2025 16:57
Add a new function that replaces util.add_to_migration_reports.

The new function can automatically parse the provided data as a list of records.
It can also limit the number of displayed records to prevent the upgrade report from growing too large.

The structure of the note is now defined within the function itself, standardizing its appearance.
@diagnoza diagnoza force-pushed the master-add_report-owi branch from c48c6f9 to 64d430b Compare December 8, 2025 16:59
@diagnoza diagnoza requested a review from aj-fuentes December 8, 2025 17:00
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.

4 participants