Skip to content

Commit b548da1

Browse files
committed
[ADD][16.0] fs_document
1 parent 3083166 commit b548da1

File tree

10 files changed

+547
-0
lines changed

10 files changed

+547
-0
lines changed

fs_document/README.rst

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
=====================================
2+
Base Document Attachment Object Store
3+
=====================================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:d6a9ffc01c8fc6c6ee93edd0dd763a673d955028b2819df121acc1a45f80af8e
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstorage-lightgray.png?logo=github
20+
:target: https://github.com/OCA/storage/tree/16.0/fs_document
21+
:alt: OCA/storage
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/storage-16-0/storage-16-0-fs_document
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/storage&target_branch=16.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This addon allow the usage of the document app attachments on an external
32+
storage system.
33+
34+
**Table of contents**
35+
36+
.. contents::
37+
:local:
38+
39+
Bug Tracker
40+
===========
41+
42+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/storage/issues>`_.
43+
In case of trouble, please check there if your issue has already been reported.
44+
If you spotted it first, help us to smash it by providing a detailed and welcomed
45+
`feedback <https://github.com/OCA/storage/issues/new?body=module:%20fs_document%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
46+
47+
Do not contact contributors directly about support or help with technical issues.
48+
49+
Credits
50+
=======
51+
52+
Authors
53+
~~~~~~~
54+
55+
* ERP|OPEN B.V.
56+
57+
Contributors
58+
~~~~~~~~~~~~
59+
60+
Goncalo Brito <gbrito@gdsbb.org>
61+
62+
Maintainers
63+
~~~~~~~~~~~
64+
65+
This module is maintained by the OCA.
66+
67+
.. image:: https://odoo-community.org/logo.png
68+
:alt: Odoo Community Association
69+
:target: https://odoo-community.org
70+
71+
OCA, or the Odoo Community Association, is a nonprofit organization whose
72+
mission is to support the collaborative development of Odoo features and
73+
promote its widespread use.
74+
75+
This module is part of the `OCA/storage <https://github.com/OCA/storage/tree/16.0/fs_document>`_ project on GitHub.
76+
77+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

fs_document/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models

fs_document/__manifest__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright (c) 2024 ERP|OPEN <https://www.erpopen.nl>
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
3+
4+
5+
{
6+
"name": "Base Document Attachment Object Store",
7+
"summary": "Enable fetching external stored document.document",
8+
"version": "16.0.1.0.0",
9+
"author": "ERP|OPEN B.V. , Odoo Community Association (OCA)",
10+
"license": "AGPL-3",
11+
"development_status": "Beta",
12+
"category": "Knowledge Management",
13+
"depends": ["documents", "fs_attachment"],
14+
"website": "https://github.com/OCA/storage",
15+
"installable": True,
16+
"auto_install": False,
17+
}

fs_document/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import ir_binary

fs_document/models/ir_binary.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (c) 2024 ERP|OPEN <https://www.erpopen.nl>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import models
5+
6+
from odoo.addons.fs_attachment.fs_stream import FsStream
7+
8+
9+
class IrBinary(models.AbstractModel):
10+
_inherit = "ir.binary"
11+
12+
def _record_to_stream(self, record, field_name):
13+
# Extend base implementation to support attachment stored into a
14+
# filesystem storage
15+
if (
16+
record._name == "documents.document"
17+
and field_name in ("raw", "datas", "db_datas")
18+
and record.attachment_id.fs_filename
19+
):
20+
return FsStream.from_fs_attachment(record.attachment_id.sudo())
21+
return super()._record_to_stream(record, field_name)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Goncalo Brito <gbrito@gdsbb.org>

fs_document/readme/DESCRIPTION.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This addon allow the usage of the document app attachments on an external
2+
storage system.

0 commit comments

Comments
 (0)