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>
15 lines
477 B
Python
15 lines
477 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import _, models
|
|
|
|
|
|
class KarmaTracking(models.Model):
|
|
_inherit = 'gamification.karma.tracking'
|
|
|
|
def _get_origin_selection_values(self):
|
|
return (
|
|
super(KarmaTracking, self)._get_origin_selection_values()
|
|
+ [('slide.slide', _('Course Quiz')), ('slide.channel', self.env['ir.model']._get('slide.channel').display_name)]
|
|
)
|