Purpose ======= Some users found a way to farm karma points, so we want to be able to track the source of the karma gain / loss. Specifications ============== Now, we added a reference field `origin_ref` which store the record responsible for the karma gain / loss (e.g. a slide we just completed). In addition to this origin, we also have a new field to store the reason (e.g. "Slide completed") so we know exactly what happened and how the user gains his karma. Before, the `old_value` of the karma tracking has to be set manually, but now it's done automatically based on the value of the previous tracking of the same user. That way, it will simplify other part of the code. Add the karma reason in the website modules. Adapt those modules due to the changes in gamification. Task-2234179 closes odoo/odoo#76430 Related: odoo/enterprise#23702 Related: odoo/upgrade#3299 Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com> Co-authored-by: std-odoo <std@odoo.com>
84 lines
4.0 KiB
XML
84 lines
4.0 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo><data>
|
|
<record id="gamification_karma_tracking_view_search" model="ir.ui.view">
|
|
<field name="name">gamification.karma.tracking.view.search</field>
|
|
<field name="model">gamification.karma.tracking</field>
|
|
<field name="arch" type="xml">
|
|
<search string="Search Trackings">
|
|
<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)]"/>
|
|
<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 string="Group By" expand="1">
|
|
<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>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="gamification_karma_tracking_view_tree" model="ir.ui.view">
|
|
<field name="name">gamification.karma.tracking.view.tree</field>
|
|
<field name="model">gamification.karma.tracking</field>
|
|
<field name="arch" type="xml">
|
|
<tree 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"
|
|
attrs="{'readonly': [('id', '!=', False)]}"/>
|
|
<field name="old_value" string="Previous Total" optional="hidden"/>
|
|
<field name="gain" attrs="{'readonly': [('id', '!=', False)]}"/>
|
|
<field name="new_value" string="Total" optional="show" readonly="1"/>
|
|
</tree>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="gamification_karma_tracking_view_form" model="ir.ui.view">
|
|
<field name="name">gamification.karma.tracking.view.form</field>
|
|
<field name="model">gamification.karma.tracking</field>
|
|
<field name="arch" type="xml">
|
|
<form string="Tracking" delete="0">
|
|
<sheet>
|
|
<group>
|
|
<field name="user_id" widget="many2one_avatar_user" string="Karma Owner"
|
|
attrs="{'readonly': [('id', '!=', False)]}"/>
|
|
<field name="tracking_date"/>
|
|
<field name="gain" attrs="{'readonly': [('id', '!=', False)]}"/>
|
|
<field name="old_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>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="gamification_karma_tracking_action" model="ir.actions.act_window">
|
|
<field name="name">Karma Tracking</field>
|
|
<field name="res_model">gamification.karma.tracking</field>
|
|
<field name="view_mode">tree,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>
|