mirror of
https://github.com/OCA/knowledge.git
synced 2025-12-19 11:52:18 -06:00
[11.0][ADD] document_page_project
This commit is contained in:
committed by
Bhavesh Heliconia
parent
a014c5a848
commit
7742c09195
23
document_page_project/models/project_project.py
Normal file
23
document_page_project/models/project_project.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# Copyright 2019 Eficent Business and IT Consulting Services S.L.
|
||||
# (http://www.eficent.com)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class ProjectProject(models.Model):
|
||||
_inherit = 'project.project'
|
||||
|
||||
document_page_ids = fields.One2many(
|
||||
string='Wiki',
|
||||
comodel_name='document.page',
|
||||
inverse_name='project_id'
|
||||
)
|
||||
document_page_count = fields.Integer(
|
||||
compute='_compute_document_page_count',
|
||||
)
|
||||
|
||||
@api.multi
|
||||
def _compute_document_page_count(self):
|
||||
for rec in self:
|
||||
rec.document_page_count = len(rec.document_page_ids)
|
||||
Reference in New Issue
Block a user