Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions okr/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
notas.txt
1 change: 1 addition & 0 deletions okr/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
24 changes: 24 additions & 0 deletions okr/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
'name': "OKR",
'version': "17.0.1.0.0",
'category': 'OKR',
'summary': "Gestión de OKR",
'license': 'LGPL-3',
'description': """
Gestión de OKR
""",
'author': "Pablo Montenegro",
'depends': ['base', 'hr'],
'data': ['data/ir_module_category_data.xml',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

estructurar data segun buenas practicas

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mati, cuáles serían las buenas prácticas?

'security/ir.model.access.csv',
'views/okr_key_result.xml',
'views/okr_objective.xml',
'views/kr_ppal.xml',
],
'demo': [
'demo/kr_ppal_data.xml',
],
'application': True,
'installable': True,
'auto_install': False,
}
35 changes: 35 additions & 0 deletions okr/data/ir_module_category_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- categorias -->
<record model="ir.module.category" id="module_category_okr">
<field name="name">OKR</field>
<field name="description">OKR</field>
<field name="sequence">1</field>
</record>
<record model="ir.module.category" id="module_okr_permisos">
<field name="name">Permisos</field>
<field name="sequence">1</field>
<field name="parent_id" ref="okr.module_category_okr"/>
</record>
<!-- grupos -->
<record id="group_okr_user" model="res.groups">
<field name="name">User</field>
<field name="users" eval="[Command.link(ref('base.user_root')), Command.link(ref('base.user_admin'))]"/>
<field name="category_id" ref="module_okr_permisos"/>
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
</record>
<record id="group_okr_manager" model="res.groups">
<field name="name">Manager</field>
<field name="users" eval="[Command.link(ref('base.user_root')), Command.link(ref('base.user_admin'))]"/>
<field name="category_id" ref="module_okr_permisos"/>
<field name="implied_ids" eval="[(4, ref('okr.group_okr_user'))]"/>
</record>
<record id="okr_manager_objectives_rule" model="ir.rule">
<field name="name">OKR manager can modify all key results</field>
<field name="model_id" ref="model_okr_key_result"/>
<field name="domain_force">[(1, '=', 1)]</field>
<field name="groups" eval="[(4, ref('okr.group_okr_manager'))]"/>
</record>
</data>
</odoo>
29 changes: 29 additions & 0 deletions okr/demo/kr_ppal_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo noupdate="1">

<record model='kr.ppal' id='kr_1'>
<field name='code'>01</field>
<field name='description'>Crecer</field>
</record>

<record model='kr.ppal' id='kr_2'>
<field name='code'>02</field>
<field name='description'>Internacionalizar</field>
</record>

<record model='kr.ppal' id='kr_3'>
<field name='code'>03</field>
<field name='description'>Agregar valor al cliente</field>
</record>

<record model='kr.ppal' id='kr_4'>
<field name='code'>04</field>
<field name='description'>Producto robusto</field>
</record>

<record model='kr.ppal' id='kr_5'>
<field name='code'>05</field>
<field name='description'>Equipo motivado y feliz</field>
</record>

</odoo>
3 changes: 3 additions & 0 deletions okr/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import kr_ppal
from . import okr_key_result
from . import okr_objective
10 changes: 10 additions & 0 deletions okr/models/kr_ppal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from odoo import models, fields


class KrPPal(models.Model):
_name = "kr.ppal"
_description = "Kr ppal"
_rec_name = 'description'

code = fields.Char(required=True)
description = fields.Char(required=True)
22 changes: 22 additions & 0 deletions okr/models/okr_key_result.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from odoo import models, api, fields, _
from odoo.exceptions import ValidationError


class OkrObjetivoLine(models.Model):
_name = "okr.key_result"
_description = "OKR key result"
_check_company_auto = True

name = fields.Char(required=True)
description = fields.Char(required=True)
progress = fields.Integer(default=0, store=True)
weight = fields.Integer()
comments = fields.Char()
objective = fields.Many2one('okr.objective')
target = fields.Integer()
result = fields.Integer()
user_id = fields.Many2one('res.users', string="Responsible")
plan_de_accion = fields.Char()
interdependencies = fields.Many2many('hr.department')
realizado_en_el_q = fields.Char()
notas_proximo_q = fields.Char()
35 changes: 35 additions & 0 deletions okr/models/okr_objective.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from odoo import models, api, fields
import time
from odoo.exceptions import UserError


class OkrObjetivo(models.Model):
_name = "okr.objective"
_description = "OKR Objective"
_inherit = ['mail.thread', 'mail.activity.mixin']
_check_company_auto = True
_rec_name = 'name'

name = fields.Many2one('kr.ppal', required=True)
description = fields.Char(required=True)
department_id = fields.Many2one('hr.department')
progress = fields.Integer(compute='_compute_progress',help="Progress from zero knowledge (0%) to fully mastered (100%).", default=0, store=True)
weight = fields.Selection([('inspiracional', 'Inspiracional'), ('commitment', 'Commitment')])
comments = fields.Char()
key_result_ids = fields.One2many('okr.key_result', 'objective')
period = fields.Selection([('q1', 'Q1'), ('q2', 'Q2'), ('q3', 'Q3'), ('q4', 'Q4')], required=True)
year = fields.Char(
required=True,
default=time.strftime('%Y'),
)
user_id = fields.Many2one('res.users', string="Responsible")
company_id = fields.Many2one(
'res.company', default=lambda self: self.env.company,
help="Company for whose invoices the mandate can be used.")

@api.depends('key_result_ids')
def _compute_progress(self):
sumatory = sum(self.key_result_ids.mapped('progress')) or 0
self.progress = sumatory
if sumatory > 100:
raise UserError("The sum of the objectives progress can´t be higher than 100")
7 changes: 7 additions & 0 deletions okr/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_kr_ppal_user,access_kr_ppal_user,model_kr_ppal,group_okr_user,1,1,1,1
access_kr_ppal_manager,access_kr_ppal_manager,model_kr_ppal,group_okr_manager,1,1,1,1
access_okr_key_result_user,access_okr_key_result_user,model_okr_key_result,group_okr_user,1,1,0,0
access_okr_key_result_manager,access_okr_key_result_manager,model_okr_key_result,group_okr_manager,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
35 changes: 35 additions & 0 deletions okr/views/kr_ppal.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="kr_ppal_view_tree" model="ir.ui.view">
<field name="name">kr.principales.tree</field>
<field name="model">kr.ppal</field>
<field name="arch" type="xml">
<tree>
<field name="code"/>
<field name="description"/>
</tree>
</field>
</record>

<record id="kr_ppal_view_form" model="ir.ui.view">
<field name="name">kr.principales.form</field>
<field name="model">kr.ppal</field>
<field name="arch" type="xml">
<form>
<field name="code"/>
<field name="description"/>
</form>
</field>
</record>

<record model="ir.actions.act_window" id="action_kr_ppal">
<field name="name">KR ppales</field>
<field name="res_model">kr.ppal</field>
<field name="view_mode">tree,form</field>
</record>

<menuitem id="menu_okr_config" name="Objetivos ppales" parent="okr.objetivo_base_menu" sequence="5"/>
<menuitem action="action_kr_ppal" id="menu_kr_ppal" sequence="7" parent="okr.menu_okr_config"/>

</odoo>
26 changes: 26 additions & 0 deletions okr/views/okr_key_result.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="objective_line_view_tree" model="ir.ui.view">
<field name="name">Objetivo</field>
<field name="model">okr.key_result</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="description"/>
<field name="progress"/>
<field name="weight"/>
<field name="comments"/>
<field name="target"/>
<field name="result"/>
<field name="user_id"/>
<field name="plan_de_accion"/>
<field name="comments"/>
<field name="interdependencies" string="Interdependencies" widget="many2many_tags"/>
<field name="realizado_en_el_q"/>
<field name="notas_proximo_q"/>
</tree>
</field>
</record>

</odoo>
101 changes: 101 additions & 0 deletions okr/views/okr_objective.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="objetivo_view_form" model="ir.ui.view">
<field name="name">Objetivo</field>
<field name="model">okr.objective</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<group>
<field name="name"/>
<field name="description"/>
<field name="user_id"/>
<field name="progress"/>
<field name="weight"/>
<field name="comments"/>
<field name="department_id"/>
</group>
<group>
<field name="period"/>
<field name="year"/>
<field name="company_id" groups="base.group_multi_company" required="1"/>
</group>
</group>
<notebook>
<page id="line_tab"
name="line_tab"
string="Okr Lines">
<field name="key_result_ids">
<tree editable="bottom" string="Okr Lines" default_order="progress">
<field name="name"/>
<field name="description"/>
<field name="progress"/>
<field name="weight"/>
<field name="comments"/>
<field name="objective"/>
<field name="target"/>
<field name="result"/>
<field name="user_id"/>
<field name="plan_de_accion"/>
<field name="realizado_en_el_q"/>
<field name="notas_proximo_q"/>
<field name="interdependencies" widget="many2many_tags"/>
</tree>
</field>
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="activity_ids" widget="mail_activity"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>

<record id="objetivo_view_tree" model="ir.ui.view">
<field name="name">Objetivo</field>
<field name="model">okr.objective</field>
<field name="arch" type="xml">
<tree default_order="progress">
<field name="name"/>
<field name="description"/>
<field name="user_id"/>
<field name="progress"/>
<field name="weight"/>
<field name="comments"/>
<field name="department_id"/>
<field name="period"/>
<field name="year"/>
<field name="company_id" groups="base.group_multi_company" required="1"/>
</tree>
</field>
</record>

<record model="ir.ui.view" id="view_objetive_search">
<field name="name">okr.objective.search</field>
<field name="model">okr.objective</field>
<field name="arch" type="xml">
<search>
<field name="department_id"/>
<filter name="group_by_department_id" string="Group by department_id" context="{'group_by': 'department_id'}"/>
</search>
</field>
</record>

<record id='objective_book_action' model="ir.actions.act_window">
<field name="name">Objective</field>
<field name="res_model">okr.objective</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_objetive_search"/>
<field name="context">{'search_default_group_by_department_id': True}</field>
</record>

<menuitem name="OKR" id="objetivo_base_menu" sequence="0"/>
<menuitem name="Objetivo" id="objetivo_principal_menu"
parent="objetivo_base_menu" action="objective_book_action" sequence="2"/>

</odoo>