From 648192b83742a74513ef4a3150bc4ad010de44ed Mon Sep 17 00:00:00 2001 From: Maximiliano Mezzavilla Date: Thu, 1 Feb 2024 10:05:38 -0300 Subject: [PATCH 1/2] [ADD] okr_management: Gestion Okr Task: 34208 --- okr_management/__init__.py | 1 + okr_management/__manifest__.py | 21 +++++++++ okr_management/models/__init__.py | 1 + okr_management/models/okr_management.py | 32 +++++++++++++ okr_management/security/ir.model.access.csv | 2 + okr_management/views/okr_management_views.xml | 46 +++++++++++++++++++ 6 files changed, 103 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/security/ir.model.access.csv create mode 100644 okr_management/views/okr_management_views.xml diff --git a/okr_management/__init__.py b/okr_management/__init__.py new file mode 100644 index 00000000..9a7e03ed --- /dev/null +++ b/okr_management/__init__.py @@ -0,0 +1 @@ +from . import models \ No newline at end of file diff --git a/okr_management/__manifest__.py b/okr_management/__manifest__.py new file mode 100644 index 00000000..6e8c3a1b --- /dev/null +++ b/okr_management/__manifest__.py @@ -0,0 +1,21 @@ +{ + 'name': 'Okr', + 'version': "16.0.1.0.0", + 'category': 'Projects & Services', + 'sequence': 14, + 'summary': '', + 'author': 'ADHOC SA', + 'website': 'www.adhoc.com.ar', + 'license': 'AGPL-3', + 'images': [ + ], + 'depends': [ + ], + 'data': [ + 'security/ir.model.access.csv', + 'views/okr_management_views.xml', + ], + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/okr_management/models/__init__.py b/okr_management/models/__init__.py new file mode 100644 index 00000000..6367ca55 --- /dev/null +++ b/okr_management/models/__init__.py @@ -0,0 +1 @@ +from . import okr_management diff --git a/okr_management/models/okr_management.py b/okr_management/models/okr_management.py new file mode 100644 index 00000000..1253b8e7 --- /dev/null +++ b/okr_management/models/okr_management.py @@ -0,0 +1,32 @@ +from odoo import models, fields, api +from odoo.exceptions import UserError + +class OkrManagement(models.Model): + _name = 'okr.management' + _description = 'Okr management' + + name = fields.Char() + description = fields.Text() + user_ids = fields.Many2many( + comodel_name='res.users', + ) + progress= fields.Integer( + compute='_compute_okr_progress', + store = False, + ) + result = fields.Float() + action_plan = fields.Text() + comments = fields.Text() + + def _compute_okr_progress(self): + prog = 0 + for okr in self: + if not okr.progress: + prog = 0 + elif okr.progress: + okr.progress = okr.progress + elif self.progress < 0 or self.progress > 100: + raise UserError('Valor de progreso invalido') + else: + prog = 0 + okr.progress = prog diff --git a/okr_management/security/ir.model.access.csv b/okr_management/security/ir.model.access.csv new file mode 100644 index 00000000..42ad12d2 --- /dev/null +++ b/okr_management/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_okr_management,access_okr_management,model_okr_management,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/okr_management/views/okr_management_views.xml b/okr_management/views/okr_management_views.xml new file mode 100644 index 00000000..5472a0f5 --- /dev/null +++ b/okr_management/views/okr_management_views.xml @@ -0,0 +1,46 @@ + + + + okr.management.tree + okr.management + + + + + + + + + + + okr.management.form + okr.management + +
+ + + + + +
+ + + okr.management.search + okr.management + + + + + + + + + okr management + okr.management + + tree,form + + + + +
From 0afab6ecd9a9758f8bc4795fa80051bd547c6354 Mon Sep 17 00:00:00 2001 From: Maximiliano Mezzavilla Date: Thu, 1 Feb 2024 10:26:29 -0300 Subject: [PATCH 2/2] [MIG] okr_management: Migration to 17.0 --- okr_management/__init__.py | 2 +- okr_management/__manifest__.py | 2 +- okr_management/models/__init__.py | 1 + okr_management/models/okr_key_result.py | 27 +++++++++++++++++++ okr_management/models/okr_management.py | 19 +++++-------- okr_management/security/ir.model.access.csv | 3 ++- okr_management/views/okr_management_views.xml | 3 ++- 7 files changed, 40 insertions(+), 17 deletions(-) create mode 100644 okr_management/models/okr_key_result.py diff --git a/okr_management/__init__.py b/okr_management/__init__.py index 9a7e03ed..0650744f 100644 --- a/okr_management/__init__.py +++ b/okr_management/__init__.py @@ -1 +1 @@ -from . import models \ No newline at end of file +from . import models diff --git a/okr_management/__manifest__.py b/okr_management/__manifest__.py index 6e8c3a1b..81445d5d 100644 --- a/okr_management/__manifest__.py +++ b/okr_management/__manifest__.py @@ -1,6 +1,6 @@ { 'name': 'Okr', - 'version': "16.0.1.0.0", + 'version': "17.0.1.0.0", 'category': 'Projects & Services', 'sequence': 14, 'summary': '', diff --git a/okr_management/models/__init__.py b/okr_management/models/__init__.py index 6367ca55..bbd6293c 100644 --- a/okr_management/models/__init__.py +++ b/okr_management/models/__init__.py @@ -1 +1,2 @@ from . import okr_management +from . import okr_key_result diff --git a/okr_management/models/okr_key_result.py b/okr_management/models/okr_key_result.py new file mode 100644 index 00000000..5bcbf8c2 --- /dev/null +++ b/okr_management/models/okr_key_result.py @@ -0,0 +1,27 @@ +from odoo import models, fields, api +from odoo.exceptions import UserError + +class OkrKeyResult(models.Model): + _name = 'okr.key.result' + _description = 'Okr Key Result' + + name = fields.Char() + description = fields.Text() + objective =fields.Text() + user_ids = fields.Many2one( + 'res.users', + ) + progress= fields.Integer( + compute='_compute_okr_progress', + store = False, + ) + importance = fields.Integer()#importancia dentro del kr + target = fields.Integer()#objetivo esperado + + @api.depends('peso', 'target') + def _compute_okr_progress(self): + #mejorar codigo + prog = 0 + for rec in self: + if rec.importance and rec.target: + prog = rec.importance \ No newline at end of file diff --git a/okr_management/models/okr_management.py b/okr_management/models/okr_management.py index 1253b8e7..2edaee88 100644 --- a/okr_management/models/okr_management.py +++ b/okr_management/models/okr_management.py @@ -14,19 +14,12 @@ class OkrManagement(models.Model): compute='_compute_okr_progress', store = False, ) + okr_type = fields.Selection( + selection=[ + ('commitment', 'Commitment'), + ('inspiracional', 'Inspiracional'), + ], + ) result = fields.Float() action_plan = fields.Text() comments = fields.Text() - - def _compute_okr_progress(self): - prog = 0 - for okr in self: - if not okr.progress: - prog = 0 - elif okr.progress: - okr.progress = okr.progress - elif self.progress < 0 or self.progress > 100: - raise UserError('Valor de progreso invalido') - else: - prog = 0 - okr.progress = prog diff --git a/okr_management/security/ir.model.access.csv b/okr_management/security/ir.model.access.csv index 42ad12d2..3b7dca63 100644 --- a/okr_management/security/ir.model.access.csv +++ b/okr_management/security/ir.model.access.csv @@ -1,2 +1,3 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_okr_management,access_okr_management,model_okr_management,base.group_user,1,1,1,1 \ No newline at end of file +access_okr_management,access_okr_management,model_okr_management,base.group_user,1,1,1,1 +access_okr_key_result,access_okr_key_result,model_okr_key_result,base.group_user,1,1,1,1 diff --git a/okr_management/views/okr_management_views.xml b/okr_management/views/okr_management_views.xml index 5472a0f5..84d60a2d 100644 --- a/okr_management/views/okr_management_views.xml +++ b/okr_management/views/okr_management_views.xml @@ -19,7 +19,8 @@
- + +