Repository
OCA/storage · module folder · Try on Runboat
Module version
1.0.0
Category
Storage
Folder size
0.09 MB
License
LGPL-3
Application
No
Auto-installable
No
Website
https://github.com/OCA/storage
Last tracking update
2026-08-07 09:06:25
Authors
Akretion, Odoo Community Association (OCA)
Maintainers
Akretion, Odoo Community Association (OCA)
Committers
Stéphane Bidoul, Laurent Mignon (ACSONE)
Odoo dependencies
OCA/connector:
OCA/server-env:
OCA/storage:
odoo/odoo:
Python dependencies
python_slugify, cachetools
System dependencies
None
Required by
storage_media, storage_thumbnail
Description
External file management depending on Storage Backend module.

It include these features: \* link to any Odoo model/record \* store
metadata like: checksum, mimetype

Use cases (with help of additional modules): - store pdf (like invoices)
on a file server with high SLA - access attachments with read/write on
prod environment and only read only on dev / testing

Code Analysis

Views touched (4)
XML IDNameModelTypeStatus
storage_backend_view_form storage.backend form Inherits storage_backend.storage_backend_view_form
storage_file_view_form storage.file form New
storage_file_view_search storage.file search New
storage_file_view_tree storage.file list New
HTTP endpoints (1)
Route(s)HandlerAuthTypeMethodsFlags
/storage.file/<string:slug_name_with_id> StorageFileController.content_common public http ALL
Models touched (4)

New fields (0)

No new fields.

Public methods (1)
  • render_qweb_pdf(self, res_ids=None, data=None)

New fields (7)
  • backend_view_use_internal_url Boolean
    help='Decide if Odoo backend views should use the external URL (usually a CDN) or the internal url with direct access to the storage. This could save you some money if you pay by CDN traffic.'
  • base_url Char
    default=''
  • base_url_for_files Char
    compute='_compute_base_url_for_files' store=True
  • filename_strategy Selection
    default='name_with_id' help='Strategy to build the name of the file to be stored.\nName and ID: will store the file with its name + its id.\nSHA Hash: will use the hash of the file as filename (same method as the native attachment storage)' selection=[('name_with_id', 'Name and ID'), ('hash', 'SHA hash')]
  • is_public Boolean
    default=False help='Define if every files stored into this backend are public or not. Examples:\nPrivate: your file/image can not be displayed is the user is not logged (not available on other website);\nPublic: your file/image can be displayed if nobody is logged (useful to display files on external websites)'
  • served_by Selection
    default='odoo' required=True selection=[('odoo', 'Odoo'), ('external', 'External')]
  • url_include_directory_path Boolean
    default=False help="Normally the directory_path it's for internal usage. If this flag is enabled the path will be used to compute the public URL."
Public methods (2)
  • action_recompute_base_url_for_files(self)
    Refresh base URL for files. Rationale: all the params for computing this URL might come from server env. When this is the case, the URL - being stored - might be out of date. This is because changes to server env fields are not detected at startup. Hence, let's offer an easy way to promptly force this manually when needed.
  • write(self, vals)

New fields (18)
  • active Boolean
    default=True
  • backend_id Many2one → storage.backend
    index=True required=True args: 'storage.backend', 'Storage'
  • checksum Char
    index=True size=40 args: 'Checksum/SHA1'
  • company_id Many2one → res.company
    default=<expr> args: 'res.company', 'Company'
  • data Binary
    compute='_compute_data' copy=True help='Data' inverse='_inverse_data' store=False
  • extension Char
    compute='_compute_extract_filename' store=True
  • file_size Integer
  • file_type Selection
    args: []
  • filename Char
    compute='_compute_extract_filename' store=True args: 'Filename without extension'
  • human_file_size Char
    compute='_compute_human_file_size' store=True
  • internal_url Char
    compute='_compute_internal_url' help='HTTP URL to load the file directly from storage.'
  • mimetype Char
    compute='_compute_extract_filename' store=True args: 'Mime Type'
  • name Char
    index=True required=True
  • relative_path Char
    copy=False help='Relative location for backend'
  • slug Char
    compute='_compute_slug' help='Slug-ified name with ID for URL' store=True
  • to_delete Boolean
  • url Char
    compute='_compute_url' help='HTTP accessible path to the file'
  • url_path Char
    compute='_compute_url_path' help='Accessible path, no base URL'
Public methods (3)
  • get_from_slug_name_with_id(self, slug_name_with_id)
    @api.model
    Return a browse record from a string generated by the method _slugify_name_with_id :param slug_name_with_id: :return: a BrowseRecord (could be empty...)
  • unlink(self)
  • write(self, vals)

New fields (3)
  • data Binary
  • file_id Many2one → storage.file
    args: 'storage.file'
  • file_name Char
Public methods (1)
  • confirm(self)

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…