oca-dms/odoo-bringout-oca-dms-dms_attachment_link/dms_attachment_link/models/ir_binary.py
Ernad Husremovic ae2c6775ba Add oca-dms submodule with 10 DMS modules
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-30 17:46:17 +02:00

15 lines
557 B
Python

# Copyright 2024 Tecnativa - Víctor Martínez
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from odoo import models
class IrBinary(models.AbstractModel):
_inherit = "ir.binary"
def _record_to_stream(self, record, field_name):
"""We need to overwrite for the download and preview to be correct."""
if record._name == "ir.attachment" and record.dms_file_id:
record = record.dms_file_id
field_name = "content"
return super()._record_to_stream(record=record, field_name=field_name)