mirror of
https://github.com/bringout/oca-ocb-hr.git
synced 2026-04-25 22:32:06 +02:00
Initial commit: Hr packages
This commit is contained in:
commit
62531cd146
2820 changed files with 1432848 additions and 0 deletions
27
odoo-bringout-oca-ocb-hr/hr/models/hr_plan.py
Normal file
27
odoo-bringout-oca-ocb-hr/hr/models/hr_plan.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class HrPlan(models.Model):
|
||||
_name = 'hr.plan'
|
||||
_description = 'plan'
|
||||
|
||||
name = fields.Char('Name', required=True)
|
||||
company_id = fields.Many2one(
|
||||
'res.company', default=lambda self: self.env.company)
|
||||
department_id = fields.Many2one('hr.department', check_company=True)
|
||||
plan_activity_type_ids = fields.One2many(
|
||||
'hr.plan.activity.type', 'plan_id',
|
||||
string='Activities',
|
||||
domain="[('company_id', '=', company_id)]")
|
||||
active = fields.Boolean(default=True)
|
||||
steps_count = fields.Integer(compute='_compute_steps_count')
|
||||
|
||||
@api.depends('plan_activity_type_ids')
|
||||
def _compute_steps_count(self):
|
||||
activity_type_data = self.env['hr.plan.activity.type']._read_group([('plan_id', 'in', self.ids)], ['plan_id'], ['plan_id'])
|
||||
steps_count = {x['plan_id'][0]: x['plan_id_count'] for x in activity_type_data}
|
||||
for plan in self:
|
||||
plan.steps_count = steps_count.get(plan.id, 0)
|
||||
Loading…
Add table
Add a link
Reference in a new issue