mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-16 12:12:57 -06:00

Before this PR, users who could see projects but not knowledge were unable to access any project page due to the new fields linking knowledge documents and projects.
25 lines
706 B
Python
25 lines
706 B
Python
# Copyright 2019 ForgeFlow S.L. (https://www.forgeflow.com)
|
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
|
|
|
from odoo import fields, models
|
|
|
|
|
|
class ProjectProject(models.Model):
|
|
_inherit = "project.project"
|
|
|
|
document_page_ids = fields.One2many(
|
|
string="Wiki",
|
|
comodel_name="document.page",
|
|
inverse_name="project_id",
|
|
groups="knowledge.group_document_user",
|
|
)
|
|
|
|
document_page_count = fields.Integer(
|
|
compute="_compute_document_page_count",
|
|
groups="knowledge.group_document_user",
|
|
)
|
|
|
|
def _compute_document_page_count(self):
|
|
for rec in self:
|
|
rec.document_page_count = len(rec.document_page_ids)
|