summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorRomainLibert <rli@odoo.com>2019-04-08 11:28:09 +0200
committerYannick Tivisse <yti@odoo.com>2019-05-31 10:21:21 +0200
commitdf69d5b3450a5c8e58e27ac02761468ca03df0ba (patch)
tree70021f2576ed3359a5c59a9ea0c44564ba36ad41 /addons
parentacd8638575915c876ffbd197f75cfa66d78d6724 (diff)
[IMP] hr_gamification: Adapt module with new hr.employee.public model
Diffstat (limited to 'addons')
-rw-r--r--addons/hr_gamification/models/__init__.py1
-rw-r--r--addons/hr_gamification/models/gamification.py2
-rw-r--r--addons/hr_gamification/models/hr_employee.py11
-rw-r--r--addons/hr_gamification/models/res_users.py11
-rw-r--r--addons/hr_gamification/views/hr_employee_views.xml24
5 files changed, 39 insertions, 10 deletions
diff --git a/addons/hr_gamification/models/__init__.py b/addons/hr_gamification/models/__init__.py
index 6088b354662..002facd9929 100644
--- a/addons/hr_gamification/models/__init__.py
+++ b/addons/hr_gamification/models/__init__.py
@@ -3,3 +3,4 @@
from . import gamification
from . import hr_employee
+from . import res_users
diff --git a/addons/hr_gamification/models/gamification.py b/addons/hr_gamification/models/gamification.py
index 1107f0e0012..3e6b8af3886 100644
--- a/addons/hr_gamification/models/gamification.py
+++ b/addons/hr_gamification/models/gamification.py
@@ -39,6 +39,6 @@ class GamificationBadge(models.Model):
'name': 'Granted Employees',
'view_mode': 'kanban,tree,form',
'view_type': 'form',
- 'res_model': 'hr.employee',
+ 'res_model': 'hr.employee.public',
'domain': [('id', 'in', employee_ids)]
}
diff --git a/addons/hr_gamification/models/hr_employee.py b/addons/hr_gamification/models/hr_employee.py
index 36171bea1aa..d36edd79d49 100644
--- a/addons/hr_gamification/models/hr_employee.py
+++ b/addons/hr_gamification/models/hr_employee.py
@@ -4,8 +4,8 @@
from odoo import api, fields, models
-class HrEmployee(models.Model):
- _inherit = "hr.employee"
+class HrEmployeeBase(models.AbstractModel):
+ _inherit = "hr.employee.base"
goal_ids = fields.One2many('gamification.goal', string='Employee HR Goals', compute='_compute_employee_goals')
badge_ids = fields.One2many(
@@ -36,10 +36,3 @@ class HrEmployee(models.Model):
])
employee.has_badges = bool(badge_ids)
employee.badge_ids = badge_ids
-
-
-class ResUsers(models.Model):
- _inherit = 'res.users'
-
- goal_ids = fields.One2many('gamification.goal', 'user_id')
- badge_ids = fields.One2many('gamification.badge.user', 'user_id')
diff --git a/addons/hr_gamification/models/res_users.py b/addons/hr_gamification/models/res_users.py
new file mode 100644
index 00000000000..f5a301f7b15
--- /dev/null
+++ b/addons/hr_gamification/models/res_users.py
@@ -0,0 +1,11 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import fields, models
+
+
+class ResUsers(models.Model):
+ _inherit = 'res.users'
+
+ goal_ids = fields.One2many('gamification.goal', 'user_id')
+ badge_ids = fields.One2many('gamification.badge.user', 'user_id')
diff --git a/addons/hr_gamification/views/hr_employee_views.xml b/addons/hr_gamification/views/hr_employee_views.xml
index 4390f50327b..285d9a44136 100644
--- a/addons/hr_gamification/views/hr_employee_views.xml
+++ b/addons/hr_gamification/views/hr_employee_views.xml
@@ -25,4 +25,28 @@
</field>
</record>
+ <record id="hr_employee_public_view_form" model="ir.ui.view">
+ <field name="name">hr.employee.public.view.form.inherit</field>
+ <field name="model">hr.employee.public</field>
+ <field name="inherit_id" ref="hr.hr_employee_public_view_form"/>
+ <field name="arch" type="xml">
+
+ <xpath expr="//page[@name='public']" position="after">
+ <page string="Received Badges" attrs="{'invisible': [('user_id', '=', False)]}">
+ <field name="has_badges" invisible="1"/>
+ <button string="Grant a Badge" type="action" name="%(action_reward_wizard)d"/> to reward this employee for a good action
+ <div class="o_field_nocontent" attrs="{'invisible': [('has_badges', '=', True)]}">
+ <p>
+ Grant this employee his first badge
+ </p><p class="oe_grey">
+ Badges are rewards of good work. Give them to people you believe deserve it.
+ </p>
+ </div>
+ <field name="badge_ids" mode="kanban" widget="many2many"/>
+ </page>
+ </xpath>
+
+ </field>
+ </record>
+
</odoo>