17 lines
550 B
Python
17 lines
550 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import fields, models
|
|
|
|
|
|
class ResPartner(models.Model):
|
|
""" Inherits partner and adds Tasks information in the partner form """
|
|
_inherit = 'res.partner'
|
|
|
|
task_ids = fields.One2many('project.task', 'partner_id', string='Tasks')
|
|
task_count = fields.Integer(compute='_compute_task_count', string='# Tasks')
|
|
|
|
def _compute_task_count(self):
|
|
for partner in self:
|
|
partner.task_count = len(partner.task_ids)
|