From 93982a95fc7c98b6b8c6abc1e61a1a0e099b220d Mon Sep 17 00:00:00 2001 From: Denis Roussel Date: Sun, 18 Oct 2020 15:18:47 +0200 Subject: [PATCH] [14.0][MIG] attachment_category --- attachment_category/README.rst | 10 +++++----- attachment_category/__manifest__.py | 3 ++- attachment_category/models/ir_attachment_category.py | 5 ++++- attachment_category/static/description/index.html | 8 ++++---- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/attachment_category/README.rst b/attachment_category/README.rst index 14af0a2f..96b88797 100644 --- a/attachment_category/README.rst +++ b/attachment_category/README.rst @@ -14,13 +14,13 @@ Atachment Category :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github - :target: https://github.com/OCA/knowledge/tree/13.0/attachment_category + :target: https://github.com/OCA/knowledge/tree/14.0/attachment_category :alt: OCA/knowledge .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/knowledge-13-0/knowledge-13-0-attachment_category + :target: https://translation.odoo-community.org/projects/knowledge-14-0/knowledge-14-0-attachment_category :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/118/13.0 + :target: https://runbot.odoo-community.org/runbot/118/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -43,7 +43,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -73,6 +73,6 @@ 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/knowledge `_ project on GitHub. +This module is part of the `OCA/knowledge `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/attachment_category/__manifest__.py b/attachment_category/__manifest__.py index 5a09a117..f5653173 100644 --- a/attachment_category/__manifest__.py +++ b/attachment_category/__manifest__.py @@ -5,10 +5,11 @@ "name": "Atachment Category", "summary": """ Adds a document category to help classification""", - "version": "13.0.1.0.0", + "version": "14.0.1.0.0", "license": "AGPL-3", "author": "ACSONE SA/NV,Odoo Community Association (OCA)", "depends": ["base"], + "website": "https://github.com/OCA/knowledge", "data": [ "views/ir_attachment.xml", "security/ir_attachment_category.xml", diff --git a/attachment_category/models/ir_attachment_category.py b/attachment_category/models/ir_attachment_category.py index 790e276e..dc48811c 100644 --- a/attachment_category/models/ir_attachment_category.py +++ b/attachment_category/models/ir_attachment_category.py @@ -41,11 +41,14 @@ class IrAttachmentCategory(models.Model): else: category.display_name = category.name - @api.depends() def _compute_attachment_count(self): category_obj = self.env["ir.attachment.category"] attachment_obj = self.env["ir.attachment"] for category in self: + if isinstance(category.id, models.NewId): + category.attachment_count = 0 + category.attachment_ids = attachment_obj.browse() + continue child_categories = category_obj.search([("id", "child_of", category.id)]) attachment_ids = attachment_obj.search( [("category_ids", "in", child_categories.ids)] diff --git a/attachment_category/static/description/index.html b/attachment_category/static/description/index.html index f6e343da..18f33ecf 100644 --- a/attachment_category/static/description/index.html +++ b/attachment_category/static/description/index.html @@ -3,7 +3,7 @@ - + Atachment Category