-
-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] dms_attachment_link: Finish migration
[UPD] Update dms_attachment_link.pot
- Loading branch information
1 parent
395f435
commit 50d2472
Showing
5 changed files
with
31 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from . import dms_file | ||
from . import ir_attachment | ||
from . import ir_binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters