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..2562dd61 --- /dev/null +++ b/okr/__manifest__.py @@ -0,0 +1,19 @@ +{ + 'name': 'okr', + 'version' : '16.0.1.0', + 'author' : 'ced', + 'license' : 'AGPL-3', + 'depends': ['base', 'hr'], + 'data': [ + 'security/ir.model.access.csv', + 'views/okr_objective_views.xml', + 'views/okr_key_result_views.xml', + 'views/okr_menu.xml', + ], + 'demo': [], + 'application': True, + 'installable': True, + 'auto_install': False + + +} 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..c742181d --- /dev/null +++ b/okr/models/okr_key_result.py @@ -0,0 +1,30 @@ +from odoo import models, fields, api + +class OkrKeyResult(models.Model): + _name = 'okr.key_result' + _description = 'OKR Key Result' + + name = fields.Char(required=True) + description = fields.Text(required=True) + department_id = fields.Many2one('hr.department') + user_id = fields.Many2one('res.users', string= 'Responsible') + objective_id = fields.Many2one('okr.objective') + weight = fields.Integer() + target = fields.Integer() + result = fields.Integer() + progress = fields.Float(compute = 'compute_progress', store=True, default=0) + # state? + # interdependencias + # plan de acción + # comentarios + + @api.depends('result','target') + def _compute_progress(self): + for rec in self: + if rec.target !=0: + rec.progress = (rec.result)/(rec.target)*100 + else: + rec.progress = 0.0 + + + diff --git a/okr/models/okr_objective.py b/okr/models/okr_objective.py new file mode 100644 index 00000000..e08b2fb3 --- /dev/null +++ b/okr/models/okr_objective.py @@ -0,0 +1,23 @@ +from odoo import models, fields + +class OkrObjective(models.Model): + _name = 'okr.objective' + _description = 'OKR Objectives' + + name = fields.Char(required=True) + description = fields.Text(required=True) + user_id = fields.Many2one('res.users', string= 'Responsible') + progress = fields.Integer(default = 0) + type = fields.Selection([('commitment', 'Commitment'),('inspirational', 'Inspirational')]) + quarter = fields.Selection([('q1', 'Q1'),('q2', 'Q2'),('q3', 'Q3'),('q4', 'Q4')]) + department_id = fields.Many2one('hr.department', required=True) + key_result_ids = fields.One2many('okr.key_result', 'objective_id') + notes = fields.Text() + # state + #compute = 'compute_progress' + + + + + + diff --git a/okr/security/ir.model.access.csv b/okr/security/ir.model.access.csv new file mode 100644 index 00000000..4cf39a47 --- /dev/null +++ b/okr/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 +okr.access_okr_objective,access_okr_objective,okr.model_okr_objective,base.group_user,1,1,1,0 +okr.access_okr_key_result,access_okr_key_result,okr.model_okr_key_result,base.group_user,1,1,1,0 diff --git a/okr/views/okr_key_result_views.xml b/okr/views/okr_key_result_views.xml new file mode 100644 index 00000000..498dcb27 --- /dev/null +++ b/okr/views/okr_key_result_views.xml @@ -0,0 +1,49 @@ + + + okr.key_result.tree + okr.key_result + + + + + + + + + + + + + + + + + okr.key_result.form + okr.key_result + +
+ + + + + + + + + + + + + +
+
+
+ + + OKR Key Result + okr.key_result + tree,form + + +
+ diff --git a/okr/views/okr_menu.xml b/okr/views/okr_menu.xml new file mode 100644 index 00000000..f36959f9 --- /dev/null +++ b/okr/views/okr_menu.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/okr/views/okr_objective_views.xml b/okr/views/okr_objective_views.xml new file mode 100644 index 00000000..38c8cace --- /dev/null +++ b/okr/views/okr_objective_views.xml @@ -0,0 +1,54 @@ + + + okr.objective.tree + okr.objective + + + + + + + + + + + + + + + okr.objective.form + okr.objective + +
+ + + + + + + + + + + +
+
+
+ + + okr.objective.search + okr.objective + + + + + + + + + OKR Objective + okr.objective + tree,form + + +