Skip to content

Commit

Permalink
[MIG] dms_storage: depend on fs_storage
Browse files Browse the repository at this point in the history
  • Loading branch information
len-foss committed May 19, 2024
1 parent 0aaf8cc commit c211b1a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dms_storage/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"name": "Dms Storage",
"summary": """
Integrate DMS with external Storages""",
"version": "14.0.1.0.0",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "CreuBlanca,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/dms",
"depends": ["dms", "storage_backend"],
"depends": ["dms", "fs_storage"],
"data": [
"views/dms_storage.xml",
],
Expand Down
5 changes: 3 additions & 2 deletions dms_storage/models/dms_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class DmsFile(models.Model):
_inherit = "dms.file"

storage_path = fields.Char(invisible=True, readonly=True)
storage_backend_id = fields.Many2one("storage.backend")
storage_backend_id = fields.Many2one("fs.storage")

def _update_content_vals(self, vals, binary):
result = super(DmsFile, self)._update_content_vals(vals, binary)
Expand All @@ -28,8 +28,9 @@ def _update_content_vals(self, vals, binary):

@api.depends("storage_path")
def _compute_content(self):
super(DmsFile, self)._compute_content()
res = super(DmsFile, self)._compute_content()
for record in self.filtered(lambda r: r.storage_path):
record.content = self.storage_backend_id.get(
record.storage_path, binary=False
)
return res
2 changes: 1 addition & 1 deletion dms_storage/models/dms_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ class DmsStorage(models.Model):
save_type = fields.Selection(
selection_add=[("storage", "Storage")], ondelete={"storage": "cascade"}
)
storage_backend_id = fields.Many2one("storage.backend")
storage_backend_id = fields.Many2one("fs.storage")

0 comments on commit c211b1a

Please sign in to comment.