Skip to content
Snippets Groups Projects
Commit df69d5b3 authored by RomainLibert's avatar RomainLibert Committed by Yannick Tivisse
Browse files

[IMP] hr_gamification: Adapt module with new hr.employee.public model

parent acd86385
Branches
Tags
No related merge requests found
......@@ -3,3 +3,4 @@
from . import gamification
from . import hr_employee
from . import res_users
......@@ -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)]
}
......@@ -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')
# -*- 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')
......@@ -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>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment