diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
| commit | 3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch) | |
| tree | a44932296ef4a9b71d5f010906253d8c53727726 /addons/survey/models/badge.py | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/survey/models/badge.py')
| -rw-r--r-- | addons/survey/models/badge.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/addons/survey/models/badge.py b/addons/survey/models/badge.py new file mode 100644 index 00000000..7ed12731 --- /dev/null +++ b/addons/survey/models/badge.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import api, fields, models + + +class GamificationBadge(models.Model): + _inherit = 'gamification.badge' + + survey_ids = fields.One2many('survey.survey', 'certification_badge_id', 'Survey Ids') + survey_id = fields.Many2one('survey.survey', 'Survey', compute='_compute_survey_id', store=True) + + @api.depends('survey_ids.certification_badge_id') + def _compute_survey_id(self): + for badge in self: + badge.survey_id = badge.survey_ids[0] if badge.survey_ids else None |
