diff --git a/okr_module/__init__.py b/okr_module/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/okr_module/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/okr_module/__manifest__.py b/okr_module/__manifest__.py new file mode 100644 index 00000000..ffc09901 --- /dev/null +++ b/okr_module/__manifest__.py @@ -0,0 +1,23 @@ +{ + 'name': 'OKR Module', + 'version': "17.0.1.0.0", + 'category': 'Base', + 'sequence': 14, + 'summary': '', + 'author': 'ADHOC SA', + 'website': 'www.adhoc.com.ar', + 'license': 'AGPL-3', + 'images': [ + ], + 'depends': ['contacts' + ], + 'data': ['security/ir.model.access.csv', + 'views/okr_base.xml', + 'views/menu.xml', + ], + 'demo': [ + ], + 'installable': True, + 'auto_install': False, + 'application': True, +} diff --git a/okr_module/models/__init__.py b/okr_module/models/__init__.py new file mode 100644 index 00000000..cb03fb18 --- /dev/null +++ b/okr_module/models/__init__.py @@ -0,0 +1 @@ +from . import okr_base diff --git a/okr_module/models/okr_base.py b/okr_module/models/okr_base.py new file mode 100644 index 00000000..06237776 --- /dev/null +++ b/okr_module/models/okr_base.py @@ -0,0 +1,50 @@ +from odoo import api, models, fields + +class OkrBase(models.Model): + _description = 'OKR BASE' + _name = "okr.base" + + name = fields.Char(required=True) + description = fields.Char() + user_id = fields.Many2one('res.users') + completed_percentage = fields.Float(compute='_compute_completed_percentage') + type = fields.Selection(selection=[('commitment', 'commitment'),('inspirational', 'inspirational')], required=True) + kr_line_ids = fields.One2many('okr.base.line', 'okr_base_id') + + def _compute_completed_percentage(self): + for kr in self: + if kr.kr_line_ids: + w_cum = 0 + sum_weigh = 0 + for krl in kr.kr_line_ids: + w_cum += krl.completed_percentage*krl.weight + sum_weigh += krl.weight + if sum_weigh>0: + kr.completed_percentage = w_cum/sum_weigh + else: + kr.completed_percentage = 0 + else: + kr.completed_percentage = 0 + + + +class OkrBaseLine(models.Model): + _description = 'OKR LINE' + _name = "okr.base.line" + + name = fields.Char() + description = fields.Char() + user_id = fields.Many2one('res.users') + okr_base_id = fields.Many2one(comodel_name='okr.base', required=True) + actual_value = fields.Float() + weight = fields.Float() + target = fields.Float() + completed_percentage = fields.Float(compute='_compute_completed_percentage_line') + + def _compute_completed_percentage_line(self): + for kr in self: + kr.completed_percentage = 0 + if kr.actual_value>0 and kr.actual_value + + + + + diff --git a/okr_module/views/okr_base.xml b/okr_module/views/okr_base.xml new file mode 100644 index 00000000..e0dece26 --- /dev/null +++ b/okr_module/views/okr_base.xml @@ -0,0 +1,100 @@ + + + + Tree OKR + okr.base + + + + + + + + + + + Tree OKR Line + okr.base.line + + + + + + + + + + + + Form OKR + okr.base + +
+ + + + + + + + + + + + + + + + + + +
+
+
+ + + okr.base.search_view + okr.base + + + + + + + + + + + okr.base.line.search_view + okr.base.line + + + + + + + + + + + + + Menu OKR + okr.base + tree,form + [] + +

Segui tus OKR

+
+
+ + OKR lines + okr.base.line + tree,form + [] + +

Segui tus OKR

+
+
+ +