19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:32:43 +01:00
parent 4607ccbd2e
commit 825ff6514e
487 changed files with 184979 additions and 195262 deletions

View file

@ -5,30 +5,27 @@
<field name="name">Badge User Kanban View</field>
<field name="model">gamification.badge.user</field>
<field name="arch" type="xml">
<kanban class="oe_background_grey" action="action_open_badge" type="object">
<field name="badge_name"/>
<field name="badge_id"/>
<field name="user_id"/>
<field name="comment"/>
<kanban action="action_open_badge" type="object">
<field name="create_date"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_card oe_kanban_global_click oe_kanban_badge oe_kanban_color_white o_kanban_gamification">
<div class="o_kanban_content">
<div class="o_kanban_image">
<a type="open"><img t-att-src="kanban_image('gamification.badge', 'image_1024', record.badge_id.raw_value)" t-att-title="record.badge_name.value" t-att-alt="record.badge_name.value" /></a>
</div>
<div class="oe_kanban_details">
<h4 class="mt0 mb0">
<a class="o_kanban_record_title" type="open"><t t-esc="record.badge_name.raw_value" /></a>
</h4>
<t t-if="record.comment.raw_value">
<p class="o_kanban_record_subtitle"><em><field name="comment"/></em></p>
</t>
<p>Granted by <a type="open"><field name="create_uid" /></a> the <t t-esc="luxon.DateTime.fromISO(record.create_date.raw_value).toFormat('D')" /></p>
<t t-name="card" class="row g-0">
<t t-name="card" class="g-0 row ps-2">
<div class="col">
<field class="fw-bold fs-5" type="open" name="badge_name"/>
<div>
Granted on <t t-esc="luxon.DateTime.fromISO(record.create_date.raw_value).toFormat('D')"/>
<div class="d-flex align-items-center">
By
<field class="m-0 mx-1 oe_inline" name="create_uid" options="{'no_open': True}" widget="many2one_avatar_user"/>
<field name="create_uid" options="{'no_open': True}"/>
</div>
</div>
</div>
</div>
<div class="col-2">
<field name="badge_id" widget="image" options="{'preview_image': 'image_1024'}" t-att-alt="record.badge_name.value" />
</div>
<field class="mt-1 o_badge_content text-muted" name="comment"/>
</t>
</t>
</templates>
</kanban>

View file

@ -16,7 +16,8 @@
<record id="badge_list_action" model="ir.actions.act_window">
<field name="name">Badges</field>
<field name="res_model">gamification.badge</field>
<field name="view_mode">kanban,tree,form</field>
<field name="path">badges</field>
<field name="view_mode">kanban,list,form</field>
<field name="search_view_id" ref="gamification_badge_view_search"/>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
@ -34,13 +35,13 @@
<field name="name">Badge List</field>
<field name="model">gamification.badge</field>
<field name="arch" type="xml">
<tree string="Badge List">
<list string="Badge List">
<field name="name"/>
<field name="granted_count"/>
<field name="stat_this_month"/>
<field name="stat_my"/>
<field name="rule_auth"/>
</tree>
</list>
</field>
</record>
@ -50,11 +51,11 @@
<field name="arch" type="xml">
<form string="Badge">
<header>
<button string="Grant this Badge" type="action" name="%(action_grant_wizard)d" class="oe_highlight" attrs="{'invisible': [('remaining_sending','=',0)]}" />
<button string="Grant this Badge" type="action" name="%(action_grant_wizard)d" class="oe_highlight" invisible="remaining_sending == 0" />
</header>
<sheet>
<div class="oe_button_box" name="button_box"/>
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" invisible="active"/>
<field name="image_1920" widget="image" class="oe_avatar" options="{'preview_image': 'image_128'}"/>
<div class="oe_title">
<label for="name"/>
@ -66,30 +67,30 @@
<field name="description" nolabel="1" placeholder="Badge Description" colspan="2"/>
</group>
<group string="Granting">
<div class="oe_grey" colspan="2">
<div class="opacity-50" colspan="2">
Security rules to define who is allowed to manually grant badges. Not enforced for administrator.
</div>
<group>
<field name="active" invisible="1"/>
<field name="rule_auth" widget="radio"/>
<field name="rule_auth_user_ids" attrs="{'invisible': [('rule_auth','!=','users')]}" widget="many2many_tags" />
<field name="rule_auth_badge_ids" attrs="{'invisible': [('rule_auth','!=','having')]}" widget="many2many_tags" />
<field name="rule_max" attrs="{'invisible': [('rule_auth','=','nobody')]}" />
<field name="rule_max_number" attrs="{'invisible': ['|',('rule_max','=',False),('rule_auth','=','nobody')]}"/>
<field name="rule_auth_user_ids" invisible="rule_auth != 'users'" widget="many2many_tags" />
<field name="rule_auth_badge_ids" invisible="rule_auth != 'having'" widget="many2many_tags" />
<field name="rule_max" invisible="rule_auth == 'nobody'" />
<field name="rule_max_number" invisible="not rule_max or rule_auth == 'nobody'"/>
<label for="stat_my_monthly_sending"/>
<div>
<field name="stat_my_monthly_sending" attrs="{'invisible': [('rule_auth','=','nobody')]}" />
<div attrs="{'invisible': [('remaining_sending','=',-1)]}" class="oe_grey">
<field name="stat_my_monthly_sending" invisible="rule_auth == 'nobody'" />
<div invisible="remaining_sending == -1" class="opacity-50">
You can still grant <field name="remaining_sending" class="oe_inline"/> badges this month
</div>
<div attrs="{'invisible': [('remaining_sending','!=',-1)]}" class="oe_grey">
<div invisible="remaining_sending != -1" class="opacity-50">
No monthly sending limit
</div>
</div>
</group>
</group>
<group string="Rewards for challenges">
<field name="challenge_ids" mode="kanban" widget="many2many" nolabel="1" context="{'default_reward_id': active_id}" colspan="2"/>
<field name="challenge_ids" mode="kanban" widget="many2many" nolabel="1" context="{'default_reward_id': id}" colspan="2"/>
<field name="level" colspan="2"/>
</group>
<group id="badge_statistics" string="Statistics">
@ -113,51 +114,36 @@
<field name="name">Badge Kanban View</field>
<field name="model">gamification.badge</field>
<field name="arch" type="xml">
<kanban class="o_kanban_badge">
<field name="id"/>
<field name="name"/>
<field name="description"/>
<field name="stat_my"/>
<field name="granted_count"/>
<field name="stat_this_month"/>
<field name="unique_owner_ids"/>
<field name="stat_my_monthly_sending"/>
<kanban>
<field name="remaining_sending" />
<field name="rule_max_number" />
<templates>
<t t-name="kanban-box">
<div t-attf-class="o_kanban_gamification oe_kanban_global_click #{record.stat_my.raw_value ? 'oe_kanban_color_5' : 'oe_kanban_color_white'}">
<div class="o_kanban_image">
<img t-att-src="kanban_image('gamification.badge', 'image_1024', record.id.raw_value)" t-att-title="record.name.value" t-att-alt="record.name.value"/>
<t t-name="card" class="row g-0">
<aside class="col-2">
<field name="image_1024" widget="image" t-att-alt="record.name.value"/>
</aside>
<main class="col ps-2">
<span>
<field class="fw-bold fs-5 me-1" name="name"/>
<t t-if="record.remaining_sending.value != -1">
<field name="stat_my_monthly_sending"/>/<field name="rule_max_number"/>
</t>
<t t-else="">
<field name="stat_my_monthly_sending"/>/∞
</t>
</span>
<div t-if="record.remaining_sending.value == 0">Can not grant</div>
<div>
<field class="fw-bold" name="granted_count"/> granted,
<field class="fw-bold" name="stat_this_month"/> this month
</div>
<div class="oe_kanban_details">
<strong class="o_kanban_record_title"><field name="name"/></strong>
<span class="oe_grey">
<t t-if="record.remaining_sending.value != -1">
<t t-esc="record.stat_my_monthly_sending.value"/>/<t t-esc="record.rule_max_number.value"/>
</t>
<t t-if="record.remaining_sending.value == -1">
<t t-esc="record.stat_my_monthly_sending.value"/>/∞
</t>
</span>
<div t-if="record.remaining_sending.value == 0" class="oe_grey">Can not grant</div>
<div>
<strong><t t-esc="record.granted_count.raw_value"/></strong> granted,
<strong><t t-esc="record.stat_this_month.raw_value"/></strong> this month
</div>
<div t-if="!widget.isHtmlEmpty(record.description.value)" class="o_kanban_badge_description pb-3">
<em t-out="record.description.value"/>
<div>
<t t-foreach="record.unique_owner_ids.raw_value.slice(0,11)" t-as="owner" t-key="owner">
<img class="oe_kanban_avatar o_image_24_cover rounded-circle" t-att-src="kanban_image('res.users', 'avatar_128', owner)" t-att-data-member_id="owner" alt="Owner"/>
</t>
</div>
</div>
<div t-if="record.remaining_sending.value != 0 and !selection_mode" class="o_kanban_button">
<button type="action" name="%(action_grant_wizard)d" class="oe_highlight btn btn-primary">Grant</button>
</div>
<div>
<field class="fst-italic" name="description"/>
<field name="unique_owner_ids" widget="many2many_avatar_user"/>
</div>
</div>
<footer t-if="record.remaining_sending.value != 0 and !selection_mode">
<button type="action" name="%(action_grant_wizard)d" class="btn btn-primary ms-auto">Grant</button>
</footer>
</main>
</t>
</templates>
</kanban>

View file

@ -5,10 +5,10 @@
<field name="name">Challenge line list</field>
<field name="model">gamification.challenge.line</field>
<field name="arch" type="xml">
<tree string="Challenge Lines" >
<list string="Challenge Lines" >
<field name="definition_id"/>
<field name="target_goal" string="Target"/>
</tree>
</list>
</field>
</record>

View file

@ -4,12 +4,12 @@
<field name="name">Challenges List</field>
<field name="model">gamification.challenge</field>
<field name="arch" type="xml">
<tree string="Challenges" decoration-info="state == 'draft'" decoration-muted="state == 'done'">
<list string="Challenges" decoration-info="state == 'draft'" decoration-muted="state == 'done'">
<field name="name"/>
<field name="period"/>
<field name="manager_id"/>
<field name="state"/>
</tree>
</list>
</field>
</record>
@ -19,9 +19,9 @@
<field name="arch" type="xml">
<form string="Challenge">
<header>
<button string="Start Challenge" type="object" name="action_start" states="draft" class="oe_highlight"/>
<button string="Refresh Challenge" type="object" name="action_check" states="inprogress"/>
<button string="Send Report" type="object" name="action_report_progress" states="inprogress,done" groups="base.group_no_one"/>
<button string="Start Challenge" type="object" name="action_start" invisible="state != 'draft'" class="oe_highlight"/>
<button string="Refresh Challenge" type="object" name="action_check" invisible="state != 'inprogress'"/>
<button string="Send Report" type="object" name="action_report_progress" invisible="state not in ('inprogress', 'done')" groups="base.group_no_one"/>
<field name="state" widget="statusbar" options="{'clickable': '1'}"/>
</header>
<sheet>
@ -37,10 +37,9 @@
name="%(goals_from_challenge_act)d"
class="oe_stat_button"
icon="fa-gift"
attrs="{'invisible': [('state','=','draft')]}">
invisible="state == 'draft'">
<div class="o_field_widget o_stat_info">
<span class="o_stat_text">Related</span>
<span class="o_stat_text">Goals</span>
<span class="o_stat_text">Related Goals</span>
</div>
</button>
</div>
@ -56,38 +55,38 @@
</div>
<group>
<group>
<field name="period" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="period" readonly="state != 'draft'"/>
<field name="visibility_mode" widget="radio" colspan="1" />
</group>
<group>
<field name="manager_id"/>
<field name="start_date" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="end_date" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="start_date" readonly="state != 'draft'"/>
<field name="end_date" readonly="state != 'draft'"/>
</group>
</group>
<notebook>
<page string="Goals" name="goals">
<field name="line_ids" nolabel="1" colspan="4">
<tree string="Line List" editable="bottom" >
<list string="Line List" editable="bottom" >
<field name="sequence" widget="handle"/>
<field name="definition_id" />
<field name="condition"/>
<field name="target_goal" string="Target"/>
<field name="definition_full_suffix"/>
</tree>
</list>
</field>
<field name="description" placeholder="Describe the challenge: what is does, who it targets, why it matters..."/>
</page>
<page string="Reward" name="reward">
<group>
<field name="reward_id" attrs="{'required': [('reward_realtime','=', True)]}" />
<field name="reward_id" required="reward_realtime" />
<field name="reward_first_id" />
<field name="reward_second_id" attrs="{'invisible': [('reward_first_id','=', False)]}" />
<field name="reward_third_id" attrs="{'invisible': ['|',('reward_first_id','=', False),('reward_second_id','=', False)]}" />
<field name="reward_failure" attrs="{'invisible': [('reward_first_id','=', False)]}" />
<field name="reward_second_id" invisible="not reward_first_id" />
<field name="reward_third_id" invisible="not reward_first_id or not reward_second_id" />
<field name="reward_failure" invisible="not reward_first_id" />
<field name="reward_realtime" />
</group>
<div class="oe_grey">
<div class="opacity-50">
<p>Badges are granted when a challenge is finished. This is either at the end of a running period (eg: end of the month for a monthly challenge), at the end date of a challenge (if no periodicity is set) or when the challenge is manually closed.</p>
</div>
</page>
@ -96,13 +95,13 @@
<field name="invited_user_ids" widget="many2many_tags" />
</group>
<group string="Notification Messages">
<div class="oe_grey" colspan="4">
<div class="opacity-50" colspan="4">
<p>Depending on the Display mode, reports will be individual or shared.</p>
</div>
<group colspan="4">
<field name="report_message_frequency"/>
<field name="report_template_id" attrs="{'invisible': [('report_message_frequency','=','never')]}" />
<field name="report_message_group_id" attrs="{'invisible': [('report_message_frequency','=','never')]}" />
<field name="report_template_id" invisible="report_message_frequency == 'never'" />
<field name="report_message_group_id" invisible="report_message_frequency == 'never'" />
</group>
</group>
<group string="Reminders for Manual Goals">
@ -118,10 +117,7 @@
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids"/>
<field name="message_ids"/>
</div>
<chatter/>
</form>
</field>
</record>
@ -130,27 +126,17 @@
<field name="name">Challenge Kanban</field>
<field name="model">gamification.challenge</field>
<field name="arch" type="xml">
<kanban string="Challenges" class="oe_background_grey">
<kanban string="Challenges">
<field name="line_ids"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_card o_kanban_gamification oe_kanban_global_click">
<div class="o_kanban_content">
<strong>
<h4 class="o_kanban_record_title"><field name="name"/></h4>
<div class="o_kanban_record_subtitle">
<a type="action" name="%(goals_from_challenge_act)d"
style="margin-right: 10px" tabindex="-1">
<span><t t-esc="record.line_ids.raw_value.length"/> Goals</span>
</a><br />
<a type="object" name="action_view_users"
style="margin-right: 10px" tabindex="-1">
<span><field name="user_count"/> Participants</span>
</a>
</div>
</strong>
</div>
</div>
<t t-name="card" class="fw-bold">
<field class="fs-5" name="name"/>
<a type="action" name="%(goals_from_challenge_act)d" class="me-2" tabindex="-1">
<t t-esc="record.line_ids.raw_value.length"/> Goals
</a>
<a type="object" name="action_view_users" class="me-2" tabindex="-1">
<field name="user_count"/> Participants
</a>
</t>
</templates>
</kanban>
@ -160,7 +146,7 @@
<record id="challenge_list_action" model="ir.actions.act_window">
<field name="name">Challenges</field>
<field name="res_model">gamification.challenge</field>
<field name="view_mode">kanban,tree</field>
<field name="view_mode">kanban,list</field>
<field name="context">{'search_default_inprogress':True, 'default_inprogress':True}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
@ -196,7 +182,7 @@
<filter name="hr_challenges" string="HR Challenges"
domain="[('challenge_category', '=', 'hr')]"/>
<field name="name"/>
<group expand="0" string="Group By">
<group>
<filter string="State" name="state" domain="[]" context="{'group_by':'state'}"/>
<filter string="Period" name="period" domain="[]" context="{'group_by':'period'}"/>
</group>

View file

@ -3,7 +3,7 @@
<record id="goal_definition_list_action" model="ir.actions.act_window">
<field name="name">Goal Definitions</field>
<field name="res_model">gamification.goal.definition</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">list,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new goal definition
@ -18,10 +18,10 @@
<field name="name">Goal Definitions List</field>
<field name="model">gamification.goal.definition</field>
<field name="arch" type="xml">
<tree string="Goal Definitions">
<list string="Goal Definitions">
<field name="name"/>
<field name="computation_mode"/>
</tree>
</list>
</field>
</record>
@ -47,21 +47,23 @@
<!-- Hide the fields below if manually -->
<field name="model_id" class="oe_inline"
attrs="{'invisible':[('computation_mode','not in',('sum', 'count'))], 'required':[('computation_mode','in',('sum', 'count'))]}"/>
invisible="computation_mode not in ('sum', 'count')"
required="computation_mode in ('sum', 'count')"/>
<field name="model_inherited_ids" invisible="1"/>
<field name="field_id" class="oe_inline" options="{'no_create': True}"
attrs="{'invisible':[('computation_mode','!=','sum')], 'required':[('computation_mode','=','sum')]}"/>
<field name="field_date_id" class="oe_inline" attrs="{'invisible':[('computation_mode','not in',('sum', 'count'))]}"/>
<field name="domain" attrs="{'invisible':[('computation_mode','not in',('sum', 'count'))], 'required':[('computation_mode','in',('sum', 'count'))]}" class="oe_inline"/>
<field name="compute_code" attrs="{'invisible':[('computation_mode','!=','python')], 'required':[('computation_mode','=','python')]}"/>
invisible="computation_mode != 'sum'"
required="computation_mode == 'sum'"/>
<field name="field_date_id" class="oe_inline" invisible="computation_mode not in ('sum', 'count')"/>
<field name="domain" invisible="computation_mode not in ('sum', 'count')" required="computation_mode in ('sum', 'count')" class="oe_inline"/>
<field name="compute_code" invisible="computation_mode != 'python'" required="computation_mode == 'python'"/>
<field name="condition" widget="radio"/>
</group>
<group string="Optimisation" name="optimisation" attrs="{'invisible': [('computation_mode', 'not in', ('sum', 'count'))]}">
<group string="Optimisation" name="optimisation" invisible="computation_mode not in ('sum', 'count')">
<field name="batch_mode" />
<div colspan="2">In batch mode, the domain is evaluated globally. If enabled, do not use keyword 'user' in above filter domain.</div>
<field name="batch_distinctive_field" attrs="{'invisible': [('batch_mode', '=', False)], 'required': [('batch_mode', '=', True)]}"
domain="[('model_id', '=', model_id)]" class="oe_inline" />
<field name="batch_user_expression" attrs="{'invisible': [('batch_mode', '=', False)], 'required': [('batch_mode', '=', True)]}" class="oe_inline"
<field name="batch_distinctive_field" invisible="not batch_mode" required="batch_mode"
domain="[('model_id', '=', model_id)]" class="oe_inline" options="{'no_create': True}"/>
<field name="batch_user_expression" invisible="not batch_mode" required="batch_mode" class="oe_inline"
placeholder="e.g. user.partner_id.id"/>
</group>
<group string="Formatting Options" name="format_options">
@ -69,9 +71,9 @@
<field name="suffix" placeholder="e.g. days" class="oe_inline"/>
<field name="monetary"/>
</group>
<group string="Clickable Goals" name="clickable_goals" attrs="{'invisible': [('computation_mode', '=', 'manually')]}">
<group string="Clickable Goals" name="clickable_goals" invisible="computation_mode == 'manually'">
<field name="action_id" class="oe_inline"/>
<field name="res_id_field" attrs="{'invisible': [('action_id', '=', False)]}" class="oe_inline"/>
<field name="res_id_field" invisible="not action_id" class="oe_inline"/>
</group>
</sheet>
@ -87,7 +89,7 @@
<field name="name"/>
<field name="model_id"/>
<field name="field_id"/>
<group expand="0" string="Group By">
<group>
<filter string="Model" name="model" domain="[]" context="{'group_by':'model_id'}"/>
<filter string="Computation Mode" name="computationmode" domain="[]" context="{'group_by':'computation_mode'}"/>
</group>

View file

@ -5,7 +5,7 @@
<record id="goal_list_action" model="ir.actions.act_window">
<field name="name">Goals</field>
<field name="res_model">gamification.goal</field>
<field name="view_mode">tree,form,kanban</field>
<field name="view_mode">list,form,kanban</field>
<field name="context">{'search_default_group_by_user': True, 'search_default_group_by_definition': True}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
@ -20,7 +20,7 @@
<record id="goals_from_challenge_act" model="ir.actions.act_window">
<field name="res_model">gamification.goal</field>
<field name="name">Related Goals</field>
<field name="view_mode">kanban,tree,form</field>
<field name="view_mode">kanban,list,form</field>
<field name="context">{'search_default_group_by_definition': True, 'search_default_inprogress': True, 'search_default_challenge_id': active_id, 'default_challenge_id': active_id}</field>
<field name="help" type="html">
<p class="o_view_nocontent_empty_folder">
@ -36,17 +36,17 @@
<field name="name">Goal List</field>
<field name="model">gamification.goal</field>
<field name="arch" type="xml">
<tree string="Goal List" decoration-danger="state == 'failed'" decoration-success="state == 'reached'" decoration-muted="state == 'canceled'" create="false">
<field name="definition_id" invisible="1" />
<field name="user_id" invisible="1" />
<list string="Goal List" decoration-danger="state == 'failed'" decoration-success="state == 'reached'" decoration-muted="state == 'canceled'" create="false">
<field name="definition_id" column_invisible="True" />
<field name="user_id" column_invisible="True" />
<field name="start_date"/>
<field name="end_date"/>
<field name="current"/>
<field name="target_goal"/>
<field name="completeness" widget="progressbar"/>
<field name="state" invisible="1"/>
<field name="line_id" invisible="1"/>
</tree>
<field name="state" column_invisible="True"/>
<field name="line_id" column_invisible="True"/>
</list>
</field>
</record>
@ -56,27 +56,27 @@
<field name="arch" type="xml">
<form string="Goal" create="false">
<header>
<button string="Start goal" type="object" name="action_start" states="draft" class="oe_highlight"/>
<button string="Start goal" type="object" name="action_start" invisible="state != 'draft'" class="oe_highlight"/>
<button string="Goal Reached" type="object" name="action_reach" states="inprogress" />
<button string="Goal Failed" type="object" name="action_fail" states="inprogress"/>
<button string="Reset Completion" type="object" name="action_cancel" states="failed,reached" groups="base.group_no_one" />
<button string="Goal Reached" type="object" name="action_reach" invisible="state != 'inprogress'" />
<button string="Goal Failed" type="object" name="action_fail" invisible="state != 'inprogress'"/>
<button string="Reset Completion" type="object" name="action_cancel" invisible="state not in ('failed', 'reached')" groups="base.group_no_one" />
<field name="state" widget="statusbar" statusbar_visible="draft,inprogress,reached" />
</header>
<sheet>
<group>
<group string="Reference">
<field name="definition_id" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="user_id" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="definition_id" readonly="state != 'draft'"/>
<field name="user_id" readonly="state != 'draft'"/>
<field name="challenge_id" />
</group>
<group string="Schedule">
<field name="start_date" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="start_date" readonly="state != 'draft'"/>
<field name="end_date" />
<field name="computation_mode" invisible="1"/>
<label for="remind_update_delay" attrs="{'invisible':[('computation_mode','!=', 'manually')]}"/>
<div attrs="{'invisible':[('computation_mode','!=', 'manually')]}">
<label for="remind_update_delay" invisible="computation_mode != 'manually'"/>
<div invisible="computation_mode != 'manually'">
<field name="remind_update_delay" class="oe_inline"/>
days
</div>
@ -85,14 +85,14 @@
<group string="Data" colspan="4">
<label for="target_goal" />
<div>
<field name="target_goal" attrs="{'readonly':[('state','!=','draft')]}" class="oe_inline"/>
<field name="target_goal" readonly="state != 'draft'" class="oe_inline"/>
<field name="definition_suffix" class="oe_inline"/>
</div>
<label for="current" />
<div>
<field name="current" class="oe_inline"/>
<button string="refresh" type="object" name="update_goal" class="oe_link" attrs="{'invisible':['|',('computation_mode', '=', 'manually'),('state', '=', 'draft')]}" />
<div class="oe_grey" attrs="{'invisible':[('definition_id', '=', False)]}">
<button string="refresh" type="object" name="update_goal" class="oe_link" invisible="computation_mode == 'manually' or state == 'draft'" />
<div class="opacity-50" invisible="not definition_id">
Reached when current value is <strong><field name="definition_condition" class="oe_inline"/></strong> than the target.
</div>
</div>
@ -117,21 +117,21 @@
('state', '=', 'inprogress'),
'&amp;',
('state', 'in', ('done', 'failed')),
('end_date', '>=', context_today().strftime('%Y-%m-%d'))
('end_date', '>=', 'today')
]"/>
<filter name="closed" string="Done"
domain="[
('state', 'in', ('reached', 'failed')),
'|',
('end_date', '=', False),
('end_date', '&lt;', context_today().strftime('%Y-%m-%d'))
('end_date', '&lt;', 'today')
]"/>
<separator/>
<field name="user_id"/>
<field name="definition_id"/>
<field name="challenge_id"/>
<group expand="0" string="Group By">
<group>
<filter name="group_by_user" string="User" domain="[]" context="{'group_by':'user_id'}"/>
<filter name="group_by_definition" string="Goal Definition" domain="[]" context="{'group_by':'definition_id'}"/>
<filter string="State" name="state" domain="[]" context="{'group_by':'state'}"/>
@ -145,63 +145,44 @@
<field name="name">Goal Kanban View</field>
<field name="model">gamification.goal</field>
<field name="arch" type="xml">
<kanban class="oe_background_grey" create="false">
<field name="definition_id"/>
<field name="user_id"/>
<field name="current"/>
<field name="completeness"/>
<kanban highlight_color="color" create="false">
<field name="state"/>
<field name="target_goal"/>
<field name="definition_description"/>
<field name="color"/>
<field name="definition_condition"/>
<field name="definition_suffix"/>
<field name="definition_display"/>
<field name="start_date"/>
<field name="end_date"/>
<field name="last_update"/>
<templates>
<t t-name="kanban-tooltip">
<ul class="oe_kanban_tooltip">
<li><t t-esc="record.definition_description.value" /></li>
</ul>
</t>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_card oe_kanban_global_click o_kanban_gamification #{record.end_date.raw_value &lt; record.last_update.raw_value and record.state.raw_value == 'failed' ? 'oe_kanban_color_2' : ''} #{record.end_date.raw_value &lt; record.last_update.raw_value and record.state.raw_value == 'reached' ? 'oe_kanban_color_5' : ''}">
<div class="o_kanban_content text-center">
<p><strong><h4 class="oe_goal_name" tooltip="kanban-tooltip"><field name="definition_id" /></h4></strong></p>
<img class="o_image_24_cover me-1 rounded-circle" t-att-src="kanban_image('res.users', 'avatar_128', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value"/>
<field name="user_id" class="fw-bold"/>
<div class="o_goal_state_block pt-3 fs-1 fw-bolder">
<t t-if="record.definition_display.raw_value == 'boolean'">
<div class="o_goal_state">
<t t-if="record.state.raw_value=='reached'"><i role="img" class="text-success fa fa-check fa-3x" title="Goal Reached" aria-label="Goal Reached"/></t>
<t t-if="record.state.raw_value=='inprogress'"><i role="img" class="fa fa-clock-o fa-3x" title="Goal in Progress" aria-label="Goal in Progress"/></t>
<t t-if="record.state.raw_value=='failed'"><i role="img" class="text-danger fa fa-times fa-3x" title="Goal Failed" aria-label="Goal Failed"/></t>
</div>
</t>
<t t-if="record.definition_display.raw_value == 'progress'">
<t t-if="record.definition_condition.raw_value =='higher'">
<field name="current" widget="gauge" options="{'max_field': 'target_goal', 'label_field': 'definition_suffix', 'style': 'width:160px; height: 120px;'}" />
</t>
<t t-if="record.definition_condition.raw_value != 'higher'">
<div t-attf-class="o_goal_state #{record.current.raw_value == record.target_goal.raw_value+1 ? 'text-warning' : record.current.raw_value &gt; record.target_goal.raw_value ? 'text-danger' : 'text-success'}">
<t t-esc="record.current.raw_value" />
</div>
<em>Target: less than <t t-esc="record.target_goal.raw_value" /></em>
</t>
</t>
</div>
<p>
<t t-if="record.start_date.value">
From <t t-esc="record.start_date.value" />
</t>
<t t-if="record.end_date.value">
To <t t-esc="record.end_date.value" />
</t>
</p>
</div>
<t t-name="card" class="text-center">
<field class="fw-bold fs-4" name="definition_id" />
<div class="d-flex justify-content-center mt-3">
<field class="o_image_24_cover me-1 rounded" name="user_id" widget="image" options="{'preview_image': 'avatar_128'}"/>
<field name="user_id" class="fw-bold"/>
</div>
<div class="pt-3 fs-1 fw-bolder">
<t t-if="record.definition_display.raw_value == 'boolean'">
<t t-if="record.state.raw_value=='reached'"><i role="img" class="text-success fa fa-check fa-3x" title="Goal Reached" aria-label="Goal Reached"/></t>
<t t-if="record.state.raw_value=='inprogress'"><i role="img" class="text-body fa fa-clock-o fa-3x" title="Goal in Progress" aria-label="Goal in Progress"/></t>
<t t-if="record.state.raw_value=='failed'"><i role="img" class="text-danger fa fa-times fa-3x" title="Goal Failed" aria-label="Goal Failed"/></t>
</t>
<t t-if="record.definition_display.raw_value == 'progress'">
<t t-if="record.definition_condition.raw_value =='higher'">
<field name="current" widget="gauge" options="{'max_field': 'target_goal', 'label_field': 'definition_suffix', 'style': 'width:160px; height: 120px;'}" />
</t>
<t t-if="record.definition_condition.raw_value != 'higher'">
<field class="#{record.current.raw_value == record.target_goal.raw_value+1 ? 'text-warning' : record.current.raw_value &gt; record.target_goal.raw_value ? 'text-danger' : 'text-success'}" name="current" />
<em>Target: less than <field name="target_goal"/></em>
</t>
</t>
</div>
<p>
<t t-if="record.start_date.value">
From <field name="start_date" />
</t>
<t t-if="record.end_date.value">
To <field name="end_date" />
</t>
</p>
</t>
</templates>
</kanban>

View file

@ -6,7 +6,8 @@
<record id="gamification_karma_ranks_action" model="ir.actions.act_window">
<field name="name">Ranks</field>
<field name="res_model">gamification.karma.rank</field>
<field name="view_mode">tree,form</field>
<field name="path">ranks</field>
<field name="view_mode">list,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new rank
@ -31,14 +32,14 @@
</record>
<record id="gamification_karma_ranks_view_tree" model="ir.ui.view">
<field name="name">gamification.karma.ranks.view.tree</field>
<field name="name">gamification.karma.ranks.view.list</field>
<field name="model">gamification.karma.rank</field>
<field name="arch" type="xml">
<tree string="Ranks List">
<list string="Ranks List">
<field name="name"/>
<field name="karma_min"/>
<field name="rank_users_count"/>
</tree>
</list>
</field>
</record>
@ -74,7 +75,7 @@
<field name="description" placeholder="e.g. A Master Chief knows quite everything on the forum! You cannot beat him!"/>
</page>
<page string="Motivational" name="motivational">
<field name="description_motivational" placeholder="e.g. Reach this rank to gain a free mug !"/>
<field name="description_motivational" placeholder="e.g. Reach this rank to gain a free mug!"/>
</page>
</notebook>
</sheet>

View file

@ -5,12 +5,22 @@
<field name="model">gamification.karma.tracking</field>
<field name="arch" type="xml">
<search string="Search Trackings">
<field name="user_id"/>
<field name="user_id" string="Karma Owner"/>
<field name="tracking_date"/>
<field name="origin_ref_model_name"/>
<filter string="Consolidated" name="filter_consolidated"
domain="[('consolidated', '=', True)]"/>
<group string="Group By" expand="1">
<filter string="User" name="group_by_user_id"
<filter string="My Karma" name="filter_user_id"
domain="[('user_id', '=', uid)]"/>
<separator/>
<filter string="Manual" name="filter_res_users"
domain="[('origin_ref', 'ilike', 'res.users,')]"/>
<group>
<filter string="Granted By" name="group_by_create_uid"
context="{'group_by': 'create_uid'}"/>
<filter string="Source Type" name="group_by_origin_ref_model_name"
context="{'group_by': 'origin_ref_model_name'}"/>
<filter string="Karma Owner" name="group_by_user_id"
context="{'group_by': 'user_id'}"/>
</group>
</search>
@ -18,16 +28,19 @@
</record>
<record id="gamification_karma_tracking_view_tree" model="ir.ui.view">
<field name="name">gamification.karma.tracking.view.tree</field>
<field name="name">gamification.karma.tracking.view.list</field>
<field name="model">gamification.karma.tracking</field>
<field name="arch" type="xml">
<tree string="Trackings">
<field name="user_id"/>
<field name="tracking_date"/>
<field name="old_value"/>
<field name="new_value"/>
<field name="consolidated"/>
</tree>
<list string="Trackings" editable="top" delete="0" sample="1">
<field name="tracking_date" string="Date"/>
<field name="origin_ref" options="{'no_create': True}" required="1"/>
<field name="reason"/>
<field name="user_id" widget="many2one_avatar_user" string="Karma Owner"
readonly="id"/>
<field name="old_value" string="Previous Total" optional="hidden"/>
<field name="gain" readonly="id"/>
<field name="new_value" string="Total" optional="show" readonly="1"/>
</list>
</field>
</record>
@ -35,14 +48,18 @@
<field name="name">gamification.karma.tracking.view.form</field>
<field name="model">gamification.karma.tracking</field>
<field name="arch" type="xml">
<form string="Tracking">
<form string="Tracking" delete="0">
<sheet>
<group>
<field name="user_id"/>
<field name="user_id" widget="many2one_avatar_user" string="Karma Owner"
readonly="id"/>
<field name="tracking_date"/>
<field name="gain" readonly="id"/>
<field name="old_value"/>
<field name="new_value"/>
<field name="new_value" readonly="1"/>
<field name="consolidated"/>
<field name="origin_ref" options="{'no_create': True}" required="1"/>
<field name="reason"/>
</group>
</sheet>
</form>
@ -50,9 +67,17 @@
</record>
<record id="gamification_karma_tracking_action" model="ir.actions.act_window">
<field name="name">Trackings</field>
<field name="name">Karma Tracking</field>
<field name="res_model">gamification.karma.tracking</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">list,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
No Karma Tracking
</p>
<p>
Track the sources of the users karma and monitor
</p>
</field>
</record>
</data>
</odoo>

View file

@ -7,9 +7,12 @@
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<group name="messaging" position="inside">
<field name="karma"/>
</group>
<xpath expr="//div[@name='button_box']" position="inside">
<button type="object" class="oe_stat_button" groups="base.group_no_one"
name="action_karma_report" icon="fa-certificate">
<field string="Karma" name="karma" widget="statinfo"/>
</button>
</xpath>
</field>
</record>
@ -17,13 +20,12 @@
<record id="action_current_rank_users" model="ir.actions.act_window">
<field name="name">Users</field>
<field name="res_model">res.users</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">list,form</field>
<field name="domain">[('rank_id', '=', active_id)]</field>
</record>
<record id="action_new_simplified_res_users" model="ir.actions.act_window">
<field name="name">Create User</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.users</field>
<field name="target">current</field>
<field name="view_id" ref="base.view_users_simple_form"/>