Skip to content

[16.0][IMP] account: migrate bank statement chatter attachments to attachment_ids#5714

Merged
pedrobaeza merged 1 commit into
OCA:16.0from
Tecnativa:16.0-MIG-account-attachments
Jun 13, 2026
Merged

[16.0][IMP] account: migrate bank statement chatter attachments to attachment_ids#5714
pedrobaeza merged 1 commit into
OCA:16.0from
Tecnativa:16.0-MIG-account-attachments

Conversation

@CarlosRoca13

Copy link
Copy Markdown

In Odoo 16, account.bank.statement gains a new attachment_ids many2many field to ir.attachment. Add a post-migration query that links the existing chatter attachments (ir.attachment with res_model = 'account.bank.statement') into this field.

cc @Tecnativa TT63091

ping @pedrobaeza @sergio-teruel

…nt_ids

In Odoo 16, account.bank.statement gains a new attachment_ids many2many field to ir.attachment. Add a post-migration query that links the existing chatter attachments (ir.attachment with res_model = 'account.bank.statement') into this field.
@OCA-git-bot OCA-git-bot added mod:openupgrade_scripts Module openupgrade_scripts series:16.0 labels Jun 12, 2026
@pedrobaeza pedrobaeza added this to the 16.0 milestone Jun 12, 2026

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

But where these attachments come from? It's an OCA module?

@sergio-teruel

Copy link
Copy Markdown

Before version 16.0, the account.bank.statement model inherited from mail.thread, so users could attach files directly to the statement record through the chatter.

Starting from 16.0, this model no longer inherits from mail.thread, so the previous attachments are no longer visible through the chatter. However, Odoo added the attachment_ids field directly on the model here:

https://github.com/odoo/odoo/blob/f95bcc097fd7e70af8d28a66c010ae9b9490f439/addons/account/models/account_bank_statement.py#L100

In addition, account_statement_base already exposes this field in the form view using the many2many_binary widget:

https://github.com/OCA/account-reconcile/blob/18.0/account_statement_base/views/account_bank_statement.xml#L83

So I think there are two possible approaches:

  1. Restore the chatter by inheriting from mail.thread again and adding the chatter back to the view.
  2. Do not restore the chatter, but migrate/recreate the relation between the bank statements and their existing attachments so they are available through the current attachment_ids field.

Personally, I would prefer option 2, because it keeps the current Odoo design and avoids reintroducing the chatter only for attachment visibility.

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

Understood. Thanks for the clarifications. They may be in the commit message, but let's not block it.

@pedrobaeza pedrobaeza merged commit 981cb52 into OCA:16.0 Jun 13, 2026
2 checks passed
@pedrobaeza pedrobaeza deleted the 16.0-MIG-account-attachments branch June 13, 2026 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:openupgrade_scripts Module openupgrade_scripts series:16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants