Skip to content

Commit

Permalink
[16.0][ADD] project_attachments: Recovers a functionality of previous…
Browse files Browse the repository at this point in the history
… version, adding a button to get all attached docs associated with a project and his tasks
  • Loading branch information
IJOL committed Oct 29, 2024
1 parent 18c813e commit 2a0e2d7
Show file tree
Hide file tree
Showing 11 changed files with 560 additions and 0 deletions.
71 changes: 71 additions & 0 deletions project_attachments/README.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/OCA/project/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 <https://github.com/OCA/project/issues/new?body=module:%20project_attachments%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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 <https://github.com/OCA/project/tree/16.0/project_attachments>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions project_attachments/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
19 changes: 19 additions & 0 deletions project_attachments/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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,
}
1 change: 1 addition & 0 deletions project_attachments/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import project
25 changes: 25 additions & 0 deletions project_attachments/models/project.py
Original file line number Diff line number Diff line change
@@ -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(

Check warning on line 10 in project_attachments/models/project.py

View check run for this annotation

Codecov / codecov/patch

project_attachments/models/project.py#L8-L10

Added lines #L8 - L10 were not covered by tests
[
"|",
"&",
("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}" % (

Check warning on line 21 in project_attachments/models/project.py

View check run for this annotation

Codecov / codecov/patch

project_attachments/models/project.py#L21

Added line #L21 was not covered by tests
self._name,
self.id,
)
return action

Check warning on line 25 in project_attachments/models/project.py

View check run for this annotation

Codecov / codecov/patch

project_attachments/models/project.py#L25

Added line #L25 was not covered by tests
1 change: 1 addition & 0 deletions project_attachments/readme/CONTRIBUTORS,rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Ignacio J. Ortega <nacho.orte...@gmail.com>
1 change: 1 addition & 0 deletions project_attachments/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Adds a button to project view to visualize the projects and project's task attachments
Loading

0 comments on commit 2a0e2d7

Please sign in to comment.