[16.0][ADD] fs_storage: Storage Addons Refactoring RFC#252
[16.0][ADD] fs_storage: Storage Addons Refactoring RFC#252OCA-git-bot merged 1 commit intoOCA:16.0from
Conversation
e98a5ad to
9ac76ff
Compare
9ac76ff to
2b2ff4e
Compare
2b2ff4e to
50be001
Compare
|
@lmignon Is this ready to test/review ? (I am asking because of the draft state) This replace storage_backend + storage_backend submodules, right ? But storage_backend is already merged. |
|
@florian-dacosta This addon is still in draft since I'm waiting the feedback from C2C (camptocamp/odoo-cloud-platform#418) to relicence to LGPL.
I'll try to finalize #262 in the coming days but I'm busy with others priorities even if #262 is a priority. I've a more complete implementation for the |
|
@lmignon Thanks for the feedback. I'll try to use this fs_storage in a project using presently storage_backend (but not storage_file) and do a review here then. |
@florian-dacosta You're right, I'll change the status. Before I'll update the |
florian-dacosta
left a comment
There was a problem hiding this comment.
LGTM
I did some tests with Odoo filestore, gtp, sftp and it went quite well.
Some minor remarks but nothing important, so I approve already.
I have tested with a real implementation (module attachment_synchronize)
Thanks for the work !
fs_storage/models/fs_storage.py
Outdated
| required=True, | ||
| help="Technical code used to identify the storage backend into the code." | ||
| "This code must be unique. This code is used for example to define the " | ||
| "storage backend to store the attachments vi the configuration parameter " |
| "installable": True, | ||
| "depends": ["base", "component", "server_environment"], |
There was a problem hiding this comment.
storage_backend did depend on server_environment, probably because you usually want to have this kind of configuration depending on the environment and also because you usually need to store some secrets, which is better not to leave in clear in the database.
Is this removal intentional, because we'd prefer to have a glue module for this ?
There was a problem hiding this comment.
@florian-dacosta it's an open question... I tend to prefer to have glue addon than having too much dependencies.
There was a problem hiding this comment.
Well, before, we'd have different fields for each protocol (sftp_login, ftp_login, etc). Including server-env was avoiding a lot of small server-env glue module.
Now, we would just need one, since every thing is in the json field and we don't have extra fields per protocol.
So, no problem for me to have a glue module.
fs_storage/models/fs_storage.py
Outdated
|
|
||
| class FSStorage(models.Model): | ||
| _name = "fs.storage" | ||
| _backend_name = "fs_storage" |
There was a problem hiding this comment.
I did not see it used anymore, is it still usefull ?
|
|
||
| # the next fields are used to display documentation to help the user | ||
| # to configure the backend | ||
| options_protocol = fields.Selection( |
There was a problem hiding this comment.
I don't get why this field is usefull as we could use protocol to display the right options_properties.
Maybe I missed something, but it would avoid some code duplication between _get_options_protocol and _get_protocols and also make sure you display the description of the chosen protocol.
It is a bit strange to have to choose a protocol and then to have to choose again to see the right description in the available option tab.
There was a problem hiding this comment.
@florian-dacosta With the lib you can nest the protocol. Therefore, the same field can be used to get access to the protocol documentation for the main protocol and when configuring nested protocols into the options field.
9ffdef7 to
fbc99fd
Compare
This addon define a new model 'fs.storage' used to get access to a filesystem storage (ftp, sftp, s3, azure, ...) through an unified interface provided by the 'fsspec' python library (https://filesystem-spec.readthedocs.io/en/latest)
fbc99fd to
a937c9b
Compare
|
/ocabot merge nobump |
|
Hey, thanks for contributing! Proceeding to merge this for you. |
|
Congratulations, your PR was merged at 16f607e. Thanks a lot for contributing to OCA. ❤️ |
A PR to track changes to the initial proposal of #251
In this PR you can find a document describing the proposal and the implementation of the first part trough the addon
fs_storage.The pr #260 implements the new addon
fs_attachmentThe pr #261 implements the new addon
fs_file