diff --git a/okr/__init__.py b/okr/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/okr/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/okr/__manifest__.py b/okr/__manifest__.py new file mode 100644 index 00000000..f7931356 --- /dev/null +++ b/okr/__manifest__.py @@ -0,0 +1,20 @@ +{ + 'name': 'OKR', + 'version': "17.0.1.0.0", + 'author': 'ADHOC SA', + 'website': 'www.adhoc.com.ar', + 'license': 'AGPL-3', + 'depends': [ + 'hr', + ], + 'data': [ + 'views/okr_objective_views.xml', + 'views/okr_key_result_views.xml', + 'security/security.xml', + 'security/ir.model.access.csv', + ], + 'demo': [ + 'demo/okr_objective_demo.xml', + ], + 'installable': True, +} diff --git a/okr/demo/okr.objective.csv b/okr/demo/okr.objective.csv new file mode 100644 index 00000000..f7e86b9a --- /dev/null +++ b/okr/demo/okr.objective.csv @@ -0,0 +1,9 @@ +id,name,department_id,description,from_date,to_date,type,user_id +okr_objective_q1_sustentabilidad_crecer,Crecer,Management / Administration,Lograr escalabilidad en los procesos masivos,2024-01-01,2024-02-29,Commitment,Mitchell Admin +okr_objective_q1_sustentabilidad_admin,Sustentabilidad,Management / Administration,Ser robustos en los procesos actuales en búsqueda de la seguridad de los mismos,2024-01-01,2024-02-29,Commitment,Mitchell Admin +okr_objective_q1_sustentabilidad_valor,Agregar valor al cliente,Management / Research & Development / R&D USA,Agregar valor a traves de mayor agilidad y mejor comunicacion,2024-01-01,2024-02-29,Commitment,Mitchell Admin +okr_objective_q1_sustentabilidad_rd,Sustentabilidad,Management / Research & Development / R&D USA,"Actualizar clientes a full, lanzar la 17 y trabajar en cultura de seguridad",2024-01-01,2024-02-29,Commitment,Mitchell Admin +okr_objective_q1_valor,Agregar valor al cliente,,Agregar valor a traves de mayor agilidad y mejor comunicacion,2024-01-01,2024-02-29,Commitment,Mitchell Admin +okr_objective_q1_crecer,Crecer,,"Crecer internacionalmente, consolidando Uruguay",2024-01-01,2024-02-29,Commitment,Mitchell Admin +okr_objective_year_crecer,Crecer,,Crecer en toda la organizacion poniendo foco en lo internacional,2024-01-01,eval(time.strftime('%Y-12-31')),Inspirational,Mitchell Admin +okr_objective_year_valor,Valor al cliente,,Aportar mas valor al cliente de manera cada vez mas tecnologica y sistematica,2024-01-01,eval(time.strftime('%Y-12-31')),Commitment,Mitchell Admin diff --git a/okr/demo/okr_objective_demo.xml b/okr/demo/okr_objective_demo.xml new file mode 100644 index 00000000..39690ab6 --- /dev/null +++ b/okr/demo/okr_objective_demo.xml @@ -0,0 +1,79 @@ + + + + Crecer + Crecer en toda la organizacion poniendo foco en lo internacional + commitment + + + + + + + Valor al Cliente + Aportar mas valor al cliente de manera cada vez mas tecnologica y sistematica + inspirational + + + + + + + Crecer internacionalmente, consolidando Uruguay + Crecer en toda la organizacion poniendo foco en lo internacional + commitment + + + + + + + Agregar valor al cliente,,Agregar valor a traves de mayor agilidad y mejor comunicacion + Aportar mas valor al cliente de manera cada vez mas tecnologica y sistematica + inspirational + + + + + + + Crecer + Lograr escalabilidad en los procesos masivos + commitment + + + + + + + + Sustentabilidad + Ser robustos en los procesos actuales en búsqueda de la seguridad de los mismos + inspirational + + + + + + + + Agregar valor al cliente + Agregar valor a traves de mayor agilidad y mejor comunicacion + commitment + + + + + + + + Sustentabilidad + Actualizar clientes a full, lanzar la 17 y trabajar en cultura de seguridad + inspirational + + + + + + + diff --git a/okr/models/__init__.py b/okr/models/__init__.py new file mode 100644 index 00000000..9a9ae6d9 --- /dev/null +++ b/okr/models/__init__.py @@ -0,0 +1,2 @@ +from . import okr_key_result +from . import okr_objective diff --git a/okr/models/okr_key_result.py b/okr/models/okr_key_result.py new file mode 100644 index 00000000..27490499 --- /dev/null +++ b/okr/models/okr_key_result.py @@ -0,0 +1,23 @@ +from odoo import models, fields, api + + +class OkrKeyResult(models.Model): + _name = 'okr.key_result' + _description = 'OKR Key Result' + _inherit = ['mail.thread', 'mail.activity.mixin'] + + name = fields.Char(required=True) + description = fields.Html() + objective_id = fields.Many2one('okr.objective', required=True, ondelete='cascade') + department_ids = fields.Many2many('hr.department', string='Interdependencies') + user_id = fields.Many2one('res.users', string='Responsible', required=True) + weight = fields.Integer(required=True) + target = fields.Integer(required=True) + result = fields.Integer() + progress = fields.Integer(compute='_compute_progress', store=True) + company_id = fields.Many2one(related='objective_id.company_id', store=True) + + @api.depends('result', 'target') + def _compute_progress(self): + for rec in self: + rec.progress = rec.result / rec.target * 100 if rec.target else 100 diff --git a/okr/models/okr_objective.py b/okr/models/okr_objective.py new file mode 100644 index 00000000..c3552295 --- /dev/null +++ b/okr/models/okr_objective.py @@ -0,0 +1,30 @@ +from odoo import models, fields, api + + +class OkrObjective(models.Model): + _name = 'okr.objective' + _description = 'OKR Objectives' + _inherit = ['mail.thread', 'mail.activity.mixin'] + _check_company_auto = True + _check_company_domain = models.check_company_domain_parent_of + # _parent_store = True + _order = 'from_date, department_id, to_date, name' + + name = fields.Char(required=True) + description = fields.Char(required=True) + notes = fields.Html() + from_date = fields.Date(required=True) + to_date = fields.Date(required=True) + # parent_path = fields.Char(index=True, unaccent=False) + # parent_id = fields.Many2one('okr.objective', index=True, ondelete='cascade', check_company=True) + department_id = fields.Many2one('hr.department',) + user_id = fields.Many2one('res.users', string='Responsible', required=True) + key_result_ids = fields.One2many('okr.key_result', 'objective_id', string='Key Results') + type = fields.Selection([('commitment', 'Commitment'), ('inspirational', 'Inspirational')], required=True) + progress = fields.Integer(compute='_compute_progress', store=True) + company_id = fields.Many2one('res.company', string='Company', default=lambda self: self.env.company) + + @api.depends('key_result_ids.progress', 'key_result_ids.weight') + def _compute_progress(self): + for rec in self: + rec.progress = sum(x.progress * x.weight/100 for x in rec.key_result_ids) diff --git a/okr/security/ir.model.access.csv b/okr/security/ir.model.access.csv new file mode 100644 index 00000000..e658d037 --- /dev/null +++ b/okr/security/ir.model.access.csv @@ -0,0 +1,4 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_okr_key_result_user,access_okr_key_result_user,model_okr_key_result,group_okr_user,1,1,1,1 +access_okr_objective_user,access_okr_objective_user,model_okr_objective,group_okr_user,1,1,0,0 +access_okr_objective_manager,access_okr_objective_manager,model_okr_objective,group_okr_manager,1,1,1,1 diff --git a/okr/security/security.xml b/okr/security/security.xml new file mode 100644 index 00000000..0c6f34ed --- /dev/null +++ b/okr/security/security.xml @@ -0,0 +1,75 @@ + + + + + + OKR + + + User + + + + + Manager + + + + + + + + + + OKR objective company rule + + ['|', ('company_id', '=', False), ('company_id', 'in', company_ids)] + + + + OKR Key Result company rule + + ['|', ('company_id', '=', False), ('company_id', 'in', company_ids)] + + + + OKR Key Result user rule by objective + + + [('objective_id.user_id', '=', user.id)] + + + + OKR Key Result user rule + + [('user_id', '=', user.id)] + + + + + + + OKR Key Result manager rule + + + [(1, '=', 1)] + + + + OKR Objective user rule + + + [('user_id', '=', user.id)] + + + + + + OKR Objective manager rule + + + [(1, '=', 1)] + + + + diff --git a/okr/views/okr_key_result_views.xml b/okr/views/okr_key_result_views.xml new file mode 100644 index 00000000..668de8f7 --- /dev/null +++ b/okr/views/okr_key_result_views.xml @@ -0,0 +1,87 @@ + + + + okr.key_result.tree + okr.key_result + + + + + + + + + + + + + + + + + okr.key_result.form + okr.key_result + +
+ + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + okr.key_result.search + okr.key_result + + + + + + + + + + + + + + + + + + + + + OKR Key Results + okr.key_result + current + tree,form + + + + +
diff --git a/okr/views/okr_objective_views.xml b/okr/views/okr_objective_views.xml new file mode 100644 index 00000000..72edc3a1 --- /dev/null +++ b/okr/views/okr_objective_views.xml @@ -0,0 +1,121 @@ + + + + okr.objective.tree + okr.objective + + + + + + + + + + + + + + + + + okr.objective.form + okr.objective + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + okr.objective.search + okr.objective + + + + + + + + + + + + + + + + + + + + + + + + + + + OKR Objectives + okr.objective + current + tree,form + {'search_default_current': 1, 'search_default_of_departments': 1} + + + + + + +