From a2f26a75c83c71bc4935225de79dd12fc34fd241 Mon Sep 17 00:00:00 2001 From: Alexis Date: Mon, 5 Feb 2024 09:13:34 -0300 Subject: [PATCH] [NEW]okr_management: new module --- okr_management/__init__.py | 1 + okr_management/__manifest__.py | 17 +++++++++++++++ okr_management/models/__init__.py | 2 ++ okr_management/models/okr_management.py | 23 +++++++++++++++++++++ okr_management/models/okr_objective.py | 11 ++++++++++ okr_management/security/ir.model.access.csv | 3 +++ okr_management/views/okr_management.xml | 11 ++++++++++ 7 files changed, 68 insertions(+) create mode 100644 okr_management/__init__.py create mode 100644 okr_management/__manifest__.py create mode 100644 okr_management/models/__init__.py create mode 100644 okr_management/models/okr_management.py create mode 100644 okr_management/models/okr_objective.py create mode 100644 okr_management/security/ir.model.access.csv create mode 100644 okr_management/views/okr_management.xml 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..df2582b1 --- /dev/null +++ b/okr_management/__manifest__.py @@ -0,0 +1,17 @@ +{ + 'name': 'OKR Management', + 'version': '17.0.1.0', + 'description': 'Module destined for Adhoc OKR Management', + 'author': 'Alexis Lopez', + 'license': 'LGPL-3', + 'depends': [ + 'base','hr', + ], + 'data': [ + 'security/ir.model.access.csv', + 'views/okr_management.xml', + ], + 'auto_install': False, + 'installable': True, + 'application': True, +} diff --git a/okr_management/models/__init__.py b/okr_management/models/__init__.py new file mode 100644 index 00000000..55d75546 --- /dev/null +++ b/okr_management/models/__init__.py @@ -0,0 +1,2 @@ +from . import okr_management +from . import okr_objective diff --git a/okr_management/models/okr_management.py b/okr_management/models/okr_management.py new file mode 100644 index 00000000..7c28296f --- /dev/null +++ b/okr_management/models/okr_management.py @@ -0,0 +1,23 @@ +from odoo import fields, models, api +from odoo.exceptions import UserError + +class OkrManagement(models.Model): + _name = 'okr.management' + _description = 'Management of Adhoc okr' + + name = fields.Char() + objective = fields.Text() + user_ids = fields.Many2many(comodel_name='res.users') + okr_type = fields.Selection(selection=[('insp', 'Inspirational'),('comm','Commitment')]) + progress = fields.Integer(compute='_compute_okr_progress', store=False) + target = fields.Integer() + result = fields.Float() + action_plan = fields.Text() + comments = fields.Text() + + def _compute_okr_progress(self): + for rec in self: + if rec.result and rec.target and rec.target != 0: + rec.progress = (rec.result / rec.target) * 100 + else: + rec.progress = 0 diff --git a/okr_management/models/okr_objective.py b/okr_management/models/okr_objective.py new file mode 100644 index 00000000..6c6e20bb --- /dev/null +++ b/okr_management/models/okr_objective.py @@ -0,0 +1,11 @@ +from odoo import api, fields, models + +class OkrObjective(models.Model): + _name = 'okr.objective' + _description = 'Okr objectives for current Q' + + name = fields.Char() + description = fields.Char() + date_start = fields.Date() + date_end = fields.Date() + teams_ids = fields.Many2one('hr.department') diff --git a/okr_management/security/ir.model.access.csv b/okr_management/security/ir.model.access.csv new file mode 100644 index 00000000..2feb0638 --- /dev/null +++ b/okr_management/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_okr_objective,access_okr_objective,model_okr_objective,base.group_user,1,1,1,1 +access_okr_management,access_okr_management,model_okr_management,base.group_user,1,1,1,1 diff --git a/okr_management/views/okr_management.xml b/okr_management/views/okr_management.xml new file mode 100644 index 00000000..a75cf33f --- /dev/null +++ b/okr_management/views/okr_management.xml @@ -0,0 +1,11 @@ + + + + + + + + + + +