From 2a0e2d71616c114e4906d501b5cbf2112d4ad787 Mon Sep 17 00:00:00 2001 From: "Ignacio J. Ortega" Date: Tue, 29 Oct 2024 14:21:06 +0100 Subject: [PATCH] [16.0][ADD] project_attachments: Recovers a functionality of previous version, adding a button to get all attached docs associated with a project and his tasks --- project_attachments/README.rst | 71 +++ project_attachments/__init__.py | 1 + project_attachments/__manifest__.py | 19 + project_attachments/models/__init__.py | 1 + project_attachments/models/project.py | 25 ++ project_attachments/readme/CONTRIBUTORS,rst | 1 + project_attachments/readme/DESCRIPTION.rst | 1 + .../static/description/index.html | 413 ++++++++++++++++++ project_attachments/views/project.xml | 21 + .../odoo/addons/project_attachments | 1 + setup/project_attachments/setup.py | 6 + 11 files changed, 560 insertions(+) create mode 100644 project_attachments/README.rst create mode 100644 project_attachments/__init__.py create mode 100644 project_attachments/__manifest__.py create mode 100644 project_attachments/models/__init__.py create mode 100644 project_attachments/models/project.py create mode 100644 project_attachments/readme/CONTRIBUTORS,rst create mode 100644 project_attachments/readme/DESCRIPTION.rst create mode 100644 project_attachments/static/description/index.html create mode 100644 project_attachments/views/project.xml create mode 120000 setup/project_attachments/odoo/addons/project_attachments create mode 100644 setup/project_attachments/setup.py diff --git a/project_attachments/README.rst b/project_attachments/README.rst new file mode 100644 index 0000000000..c6ed5331a7 --- /dev/null +++ b/project_attachments/README.rst @@ -0,0 +1,71 @@ +=================== +Project attachments +=================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:8e46d7cf57d18ee87a079ec50ade157da5af276303e3e339758cb5e0c6380957 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-OCA%2Fproject-lightgray.png?logo=github + :target: https://github.com/OCA/project/tree/16.0/project_attachments + :alt: OCA/project +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_attachments + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/project&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Adds a button to project view to visualize the projects and project's task attachments + +**Table of contents** + +.. contents:: + :local: + +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* TRIVAX SL + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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 `OCA/project `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/project_attachments/__init__.py b/project_attachments/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/project_attachments/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/project_attachments/__manifest__.py b/project_attachments/__manifest__.py new file mode 100644 index 0000000000..9ffbfeefa1 --- /dev/null +++ b/project_attachments/__manifest__.py @@ -0,0 +1,19 @@ +{ + "name": "Project attachments", + "version": "16.0.0.0.0", + "summary": "Adds a button to project view to visualize " + "the projects and project's task attachments", + "category": "Project", + "author": "TRIVAX SL,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/project", + "license": "AGPL-3", + "depends": [ + "project", + ], + "data": [ + "views/project.xml", + ], + "demo": [], + "installable": True, + "auto_install": False, +} diff --git a/project_attachments/models/__init__.py b/project_attachments/models/__init__.py new file mode 100644 index 0000000000..351a3ad34b --- /dev/null +++ b/project_attachments/models/__init__.py @@ -0,0 +1 @@ +from . import project diff --git a/project_attachments/models/project.py b/project_attachments/models/project.py new file mode 100644 index 0000000000..0a793a203f --- /dev/null +++ b/project_attachments/models/project.py @@ -0,0 +1,25 @@ +from odoo import models + + +class ModelName(models.Model): + _inherit = "project.project" + + def attachment_tree_view(self): + attachment_action = self.env.ref("base.action_attachment") + action = attachment_action.read()[0] + action["domain"] = str( + [ + "|", + "&", + ("res_model", "=", "project.project"), + ("res_id", "in", self.ids), + "&", + ("res_model", "=", "project.task"), + ("res_id", "in", self.task_ids.ids), + ] + ) + action["context"] = "{'default_res_model': '%s','default_res_id': %d}" % ( + self._name, + self.id, + ) + return action diff --git a/project_attachments/readme/CONTRIBUTORS,rst b/project_attachments/readme/CONTRIBUTORS,rst new file mode 100644 index 0000000000..1fa87fcc2d --- /dev/null +++ b/project_attachments/readme/CONTRIBUTORS,rst @@ -0,0 +1 @@ +* Ignacio J. Ortega diff --git a/project_attachments/readme/DESCRIPTION.rst b/project_attachments/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..4afa20b8c5 --- /dev/null +++ b/project_attachments/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Adds a button to project view to visualize the projects and project's task attachments diff --git a/project_attachments/static/description/index.html b/project_attachments/static/description/index.html new file mode 100644 index 0000000000..93d0532ccc --- /dev/null +++ b/project_attachments/static/description/index.html @@ -0,0 +1,413 @@ + + + + + +Project attachments + + + +
+

Project attachments

+ + +

Beta License: AGPL-3 OCA/project Translate me on Weblate Try me on Runboat

+

Adds a button to project view to visualize the projects and project’s task attachments

+

Table of contents

+ +
+

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 to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • TRIVAX SL
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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 OCA/project project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/project_attachments/views/project.xml b/project_attachments/views/project.xml new file mode 100644 index 0000000000..c3e05776e1 --- /dev/null +++ b/project_attachments/views/project.xml @@ -0,0 +1,21 @@ + + + + project.project.form + project.project + + + + + + + + + diff --git a/setup/project_attachments/odoo/addons/project_attachments b/setup/project_attachments/odoo/addons/project_attachments new file mode 120000 index 0000000000..275b3ed905 --- /dev/null +++ b/setup/project_attachments/odoo/addons/project_attachments @@ -0,0 +1 @@ +../../../../project_attachments \ No newline at end of file diff --git a/setup/project_attachments/setup.py b/setup/project_attachments/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/project_attachments/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)