Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIG] okr: Migration to 17.0 #166

Open
wants to merge 3 commits into
base: 17.0
Choose a base branch
from
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
Empty file added okr/README.rst
Empty file.
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
18 changes: 18 additions & 0 deletions okr/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "OKR",
"author": "Adhoc SA",
"version": "17.0.1.0.0",
"depends": [
'base',
'hr',
],
"data": [
'security/ir.model.access.csv',
'views/okr_objective_views.xml',
'views/okr_key_result_views.xml',
],
"license": "AGPL-3",
"installable": True,
"auto_install": False,
"application": True,
}
2 changes: 2 additions & 0 deletions okr/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import okr_objective
from . import okr_key_result
38 changes: 38 additions & 0 deletions okr/models/okr_key_result.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from odoo import models, fields, api
from datetime import date

class OkrKeyResult(models.Model):
_name = 'okr.key.result'
_description= 'OKR Key Result'

name = fields.Char(required=True)
description = fields.Char()
responsible = fields.Many2one('res.users', required=True)
objective = fields.Many2one('okr.objective', required=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

no estaria entendiendo la logica de las relaciones entre ambos modelos. Sobretodo con el calculo de resultado. Entiendo que uno deberia responder a la sumatoria proporcional del otro

priority = fields.Selection([
('very_high', 'Muy Alta'),
('high', 'ALta'),
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: Alta

('medium', 'Media'),
('low', 'Baja'),
('very_low', 'Muy Baja'),
], required=True)
target = fields.Float(required=True)
target_uom = fields.Selection([
('percentaje', '%'),
('units', 'Unidades'),
('score', 'Puntaje'),
('success', 'Casos de Éxito'),
('sla', 'SLA'),
('error', 'Errores'),
], string='Unit of Measure', required=True)
result = fields.Float(required=True)
progress = fields.Float(compute="_compute_progress")
comments = fields.Text()

@api.depends('result', 'target')
def _compute_progress(self):
for rec in self:
if rec.target:
rec.progress = (rec.result / rec.target)*100
else:
rec.progress = 0
17 changes: 17 additions & 0 deletions okr/models/okr_objective.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from odoo import models, fields
from datetime import date

class OkrObjective(models.Model):
_name = 'okr.objective'
_description= 'OKR Objective'

name = fields.Char(required=True)
description = fields.Char()
company_id = fields.Many2one('res.company')
responsible = fields.Many2one('res.users', required=True)
date_start = fields.Date(required=True, default=date.today())
date_end = fields.Date(required=True)
type = fields.Selection([
('commitment', 'Commitment'),
('inspirational', 'Inspirational'),])
comments = fields.Text()
3 changes: 3 additions & 0 deletions okr/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -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,model_okr_objective,base.group_user,1,1,1,1
okr.access_okr_key_result,access_okr_key_result,model_okr_key_result,base.group_user,1,1,1,1
55 changes: 55 additions & 0 deletions okr/views/okr_key_result_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version='1.0' encoding='utf-8'?>
<odoo>

<record id="okr_vkey_result_iew_form" model="ir.ui.view">
<field name="name">okr.key.result.view.form</field>
<field name="model">okr.key.result</field>
<field name="arch" type="xml">
<form string="">
<group>
<field name="name"/>
<field name="description"/>
<field name="responsible"/>
<field name="objective"/>
</group>
<group>
<field name="priority"/>
<field name="target"/>
<field name="target_uom"/>
<field name="result"/>
<field name="progress"/>
</group>
<notebook>
<page name="Comentarios">
<field name="comments"/>
</page>
</notebook>
</form>
</field>
</record>

<record id="okr_key_result_view_tree" model="ir.ui.view">
<field name="name">okr.key.result.view.tree</field>
<field name="model">okr.key.result</field>
<field name="arch" type="xml">
<tree>
<field name="name" string="Title"/>
<field name="objective"/>
<field name="priority"/>
<field name="target"/>
<field name="target_uom"/>
<field name="result"/>
<field name="progress"/>
</tree>
</field>
</record>

<record id="action_okr_key_result" model="ir.actions.act_window">
<field name="name">okr key result</field>
<field name="res_model">okr.key.result</field>
<field name='view_mode'>tree,form</field>
</record>

<menuitem id="menu_okr_key_result" sequence="100" action="action_okr_key_result" parent="menu_okr_objective"/>

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

<record id="okr_objective_view_form" model="ir.ui.view">
<field name="name">okr.objective.view.form</field>
<field name="model">okr.objective</field>
<field name="arch" type="xml">
<form string="">
<group>
<field name="name"/>
<field name="description"/>
<field name="company_id"/>
</group>
<group>
<field name="responsible"/>
<field name="date_start"/>
<field name="date_end"/>
<field name="type"/>
<field name="comments"/>
</group>
</form>
</field>
</record>

<record id="okr_objective_view_tree" model="ir.ui.view">
<field name="name">okr.objective.view.tree</field>
<field name="model">okr.objective</field>
<field name="arch" type="xml">
<tree>
<field name="name" string="Title"/>
<field name="responsible"/>
<field name="date_start"/>
<field name="date_end"/>
<field name="type"/>
</tree>
</field>
</record>

<record id="action_okr_objective" model="ir.actions.act_window">
<field name="name">okr objective</field>
<field name="res_model">okr.objective</field>
<field name='view_mode'>tree,form</field>
</record>

<menuitem id="menu_okr_objective" sequence="100" action="action_okr_objective"/>

</odoo>