diff --git a/okr_management/__init__.py b/okr_management/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/okr_management/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/okr_management/__manifest__.py b/okr_management/__manifest__.py new file mode 100644 index 00000000..2970048a --- /dev/null +++ b/okr_management/__manifest__.py @@ -0,0 +1,14 @@ +{ + 'name': 'OKR Management', + 'version': "17.0.1.0.0", + 'category': 'Base', + 'sequence': 14, + 'website': 'www.adhoc.com.ar', + 'license': 'AGPL-3', + 'depends': [ + 'hr', + ], + 'installable': True, + 'auto_install': False, + 'application': True, +} diff --git a/okr_management/models/__init__.py b/okr_management/models/__init__.py new file mode 100644 index 00000000..8e38419a --- /dev/null +++ b/okr_management/models/__init__.py @@ -0,0 +1,3 @@ +from . import okr_kr +from . import okr_objective +from . import okr_quarter diff --git a/okr_management/models/okr_kr.py b/okr_management/models/okr_kr.py new file mode 100644 index 00000000..e474da94 --- /dev/null +++ b/okr_management/models/okr_kr.py @@ -0,0 +1,23 @@ +from odoo import models, fields, api + +class OkrKr(models.Model): + _name = 'okr.kr' + _description = 'okr.kr' + + name = fields.Char(string='Resume', required=True) + description = fields.Char(string='Description', required=True) + objective_id = fields.Many2one('okr.objective', required=True) + progress = fields.Float(string='Progress', compute='_compute_progress') + importance = fields.Float(string='Importante') + target = fields.Float(string='Target') + result = fields.Float(string='Result') + responsible_id = fields.One2many('hr.employee') + teammate_ids = fields.Many2many('hr.employee') + action_plan = fields.Text(string='Action Plan') + #code = fields.Char(size=4, required=True) + + @api.depends('importance', 'result') + def _compute_progress(self): + for record in self: + record.progress = 100 if self.result >= self.target else self.result / self.target + diff --git a/okr_management/models/okr_objective.py b/okr_management/models/okr_objective.py new file mode 100644 index 00000000..dad43c9a --- /dev/null +++ b/okr_management/models/okr_objective.py @@ -0,0 +1,20 @@ +from odoo import models, fields, api + +class OkrObjective(models.Model): + _name = 'okr.objective' + _description = 'okr.objective' + + name = fields.Char(string='Resume', required=True) + description = fields.Char(string='Description', required=True) + objective_type = fields.Selection([('inspirational', 'Inspirational'), ('commitment', 'Commitment')], required=True, default='inspirational') + kr_ids = fields.One2many('okr.kr', 'objective_id') + progress = fields.Float(compute='_compute_progress') + responsible_id = fields.One2many('hr.employee') + teammate_ids = fields.Many2many('hr.employee') + quarter_id = fields.Many2one('okr.quarter') + #prefix_code = fields.Char() + + @api.depends('kr_ids.progress') + def _compute_progress(self): + for record in self: + record.progress = 0 # TODO diff --git a/okr_management/models/okr_quarter.py b/okr_management/models/okr_quarter.py new file mode 100644 index 00000000..3b706238 --- /dev/null +++ b/okr_management/models/okr_quarter.py @@ -0,0 +1,13 @@ +from odoo import models, fields + +class OkrQuarter(models.Model): + _name = 'okr.quarter' + _description = 'okr.quarter' + + name = fields.Char(string='Quarter', required=True) + description = fields.Char(string='Description', required=True) + start_date = fields.Date(string='Start Date', required=True) + end_date = fields.Date(string='End Date', required=True) + + department_id = fields.One2many('hr.department') + objective_ids = fields.One2many('okr.objective')