diff --git a/attachment_synchronize/README.rst b/attachment_synchronize/README.rst index cd377e983..35b73a977 100644 --- a/attachment_synchronize/README.rst +++ b/attachment_synchronize/README.rst @@ -1,24 +1,38 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 - ====================== Attachment Synchronize ====================== -This module was written to extend the functionality of ir.attachment to support remote communication and allow you to import/export file to a remote server. -For now, FTP, SFTP and local filestore are handled by the module. +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-akretion%2Fserver--tools-lightgray.png?logo=github + :target: https://github.com/akretion/server-tools/tree/12-mig-external_file_location/attachment_synchronize + :alt: akretion/server-tools + +|badge1| |badge2| |badge3| + +This module allow you to deal with remote communication to import/export files. +It allow to store paths and settings from/to remote servers. -Installation -============ +It depends of attachment_queue to store attachments -To install this module, you need to: +With additional modules coming from https://github.com/storage you can use ftp, sftp, etc -* fs python module at version 0.5.4 or under -* Paramiko python module +**Table of contents** -Usage -===== +.. contents:: + :local: + +Configuration +============= To use this module, you need to: @@ -26,45 +40,64 @@ To use this module, you need to: * Create a task with your file info and remote communication method * A cron task will trigger each task -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/149/9.0 + +.. figure:: https://raw.githubusercontent.com/akretion/server-tools/12-mig-external_file_location/attachment_synchronize/static/description/file.png + + + +.. figure:: https://raw.githubusercontent.com/akretion/server-tools/12-mig-external_file_location/attachment_synchronize/static/description/sftp.png + + +With the help of storage_backend_sftp Bug Tracker =========== -Bugs are tracked on `GitHub Issues -`_. In case of trouble, please -check there if your issue has already been reported. If you spotted it first, -help us smashing it by providing a detailed and welcomed feedback. +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= -Images ------- +Authors +~~~~~~~ -* Odoo Community Association: `Icon `_. +* Akretion Contributors ------------- +~~~~~~~~~~~~ + +`Akretion `_ : + +- Valentin CHEMIERE +- Mourad EL HADJ MIMOUNE +- Florian DA COSTA + +GS Lab: + +- Giovanni SERRA -* Valentin CHEMIERE -* Mourad EL HADJ MIMOUNE -* Florian DA COSTA -* Giovanni SERRA +Maintainers +~~~~~~~~~~~ -Maintainer ----------- +.. |maintainer-florian-dacosta| image:: https://github.com/florian-dacosta.png?size=40px + :target: https://github.com/florian-dacosta + :alt: florian-dacosta +.. |maintainer-GSLabIt| image:: https://github.com/GSLabIt.png?size=40px + :target: https://github.com/GSLabIt + :alt: GSLabIt +.. |maintainer-bealdav| image:: https://github.com/bealdav.png?size=40px + :target: https://github.com/bealdav + :alt: bealdav -.. image:: https://odoo-community.org/logo.png - :alt: Odoo Community Association - :target: https://odoo-community.org +Current maintainers: -This module is maintained by the OCA. +|maintainer-florian-dacosta| |maintainer-GSLabIt| |maintainer-bealdav| -OCA, or the Odoo Community Association, is a nonprofit organization whose -mission is to support the collaborative development of Odoo features and -promote its widespread use. +This module is part of the `akretion/server-tools `_ project on GitHub. -To contribute to this module, please visit https://odoo-community.org. +You are welcome to contribute. diff --git a/attachment_synchronize/__manifest__.py b/attachment_synchronize/__manifest__.py index 68aff2a43..f1d86490b 100644 --- a/attachment_synchronize/__manifest__.py +++ b/attachment_synchronize/__manifest__.py @@ -20,5 +20,6 @@ ], "demo": ["demo/attachment_synchronize_task_demo.xml"], "installable": True, - "application": False, + "development_status": "Beta", + "maintainers": ["florian-dacosta", "GSLabIt", "bealdav"], } diff --git a/attachment_synchronize/models/task.py b/attachment_synchronize/models/task.py index 81999f79e..5bea4d541 100644 --- a/attachment_synchronize/models/task.py +++ b/attachment_synchronize/models/task.py @@ -102,11 +102,11 @@ class AttachmentSynchronizeTask(models.Model): "when excuting the files linked to this task", ) - def _prepare_attachment_vals(self, datas, filename): + def _prepare_attachment_vals(self, data, filename): self.ensure_one() vals = { "name": filename, - "datas": datas, + "datas": data, "datas_fname": filename, "task_id": self.id, "file_type": self.file_type or False, @@ -160,9 +160,9 @@ class AttachmentSynchronizeTask(models.Model): ) try: full_absolute_path = os.path.join(filepath, file_name) - datas = backend._get_b64_data(full_absolute_path) + data = backend._get_b64_data(full_absolute_path) attach_vals = self._prepare_attachment_vals( - datas, file_name + data, file_name ) attachment = attach_obj.with_env(new_env).create( attach_vals @@ -185,7 +185,7 @@ class AttachmentSynchronizeTask(models.Model): self.move_path, new_name ) if new_full_path: - backend._add_b64_data(new_full_path, datas) + backend._add_b64_data(new_full_path, data) if self.after_import in ( "delete", "rename", @@ -208,3 +208,18 @@ class AttachmentSynchronizeTask(models.Model): lambda r: r.name in filenames ).mapped("name") return list(set(filenames) - set(imported)) + + def button_toogle_enabled(self): + for rec in self: + rec.enabled = not rec.enabled + + def button_duplicate_record(self): + self.ensure_one() + record = self.copy({"enabled": False}) + return { + "type": "ir.actions.act_window", + "res_model": record.backend_id._name, + "target": "current", + "view_mode": "form", + "res_id": record.backend_id.id, + } diff --git a/attachment_synchronize/readme/CONFIGURE.rst b/attachment_synchronize/readme/CONFIGURE.rst new file mode 100644 index 000000000..12b91d76b --- /dev/null +++ b/attachment_synchronize/readme/CONFIGURE.rst @@ -0,0 +1,15 @@ +To use this module, you need to: + +* Add a location with your server infos +* Create a task with your file info and remote communication method +* A cron task will trigger each task + + +.. figure:: ../static/description/file.png + + + +.. figure:: ../static/description/sftp.png + + +With the help of storage_backend_sftp \ No newline at end of file diff --git a/attachment_synchronize/readme/CONTRIBUTORS.rst b/attachment_synchronize/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..95bbd0811 --- /dev/null +++ b/attachment_synchronize/readme/CONTRIBUTORS.rst @@ -0,0 +1,9 @@ +`Akretion `_ : + +- Valentin CHEMIERE +- Mourad EL HADJ MIMOUNE +- Florian DA COSTA + +GS Lab: + +- Giovanni SERRA diff --git a/attachment_synchronize/readme/DESCRIPTION.rst b/attachment_synchronize/readme/DESCRIPTION.rst new file mode 100644 index 000000000..db1469eab --- /dev/null +++ b/attachment_synchronize/readme/DESCRIPTION.rst @@ -0,0 +1,6 @@ +This module allow you to deal with remote communication to import/export files. +It allow to store paths and settings from/to remote servers. + +It depends of attachment_queue to store attachments + +With additional modules coming from https://github.com/storage you can use ftp, sftp, etc diff --git a/attachment_synchronize/static/description/file.png b/attachment_synchronize/static/description/file.png new file mode 100644 index 000000000..a8617a0af Binary files /dev/null and b/attachment_synchronize/static/description/file.png differ diff --git a/attachment_synchronize/static/description/index.html b/attachment_synchronize/static/description/index.html new file mode 100644 index 000000000..026575aa0 --- /dev/null +++ b/attachment_synchronize/static/description/index.html @@ -0,0 +1,443 @@ + + + + + + +Attachment Synchronize + + + +
+

Attachment Synchronize

+ + +

Beta License: AGPL-3 akretion/server-tools

+

This module allow you to deal with remote communication to import/export files. +It allow to store paths and settings from/to remote servers.

+

It depends of attachment_queue to store attachments

+

With additional modules coming from https://github.com/storage you can use ftp, sftp, etc

+

Table of contents

+ +
+

Configuration

+

To use this module, you need to:

+
    +
  • Add a location with your server infos
  • +
  • Create a task with your file info and remote communication method
  • +
  • A cron task will trigger each task
  • +
+
+https://raw.githubusercontent.com/akretion/server-tools/12-mig-external_file_location/attachment_synchronize/static/description/file.png +
+
+https://raw.githubusercontent.com/akretion/server-tools/12-mig-external_file_location/attachment_synchronize/static/description/sftp.png +
+

With the help of storage_backend_sftp

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Akretion
  • +
+
+
+

Contributors

+

Akretion :

+ +

GS Lab:

+ +
+
+

Maintainers

+

Current maintainers:

+

florian-dacosta GSLabIt bealdav

+

This module is part of the akretion/server-tools project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/attachment_synchronize/static/description/sftp.png b/attachment_synchronize/static/description/sftp.png new file mode 100644 index 000000000..665d4258b Binary files /dev/null and b/attachment_synchronize/static/description/sftp.png differ diff --git a/attachment_synchronize/views/task_view.xml b/attachment_synchronize/views/task_view.xml index 75b8a8321..6385452d9 100644 --- a/attachment_synchronize/views/task_view.xml +++ b/attachment_synchronize/views/task_view.xml @@ -39,11 +39,16 @@ attachment.synchronize.task - + + + + +