diff options
| author | Nicolas Lempereur <nle@odoo.com> | 2017-02-13 12:20:05 +0100 |
|---|---|---|
| committer | Nicolas Lempereur <nle@odoo.com> | 2017-02-13 12:34:58 +0100 |
| commit | 83b6b71e2936bf8f4f6025574d41ebe36baf149a (patch) | |
| tree | f7c720dbbca198b882c1f08e434d34df4c262d3e /addons/gamification | |
| parent | 7c8a721a966a9678daefb23e95791d1a66369ec0 (diff) | |
[FIX] gamification: user_domain issue with not all
The field user_domain allow to get the list of users for which a
challenge is applied. The javascript framework for a char_domain widget
sends a JSON list to the server, but the server saved it as a string in
a Char field.
Hence we can have a list (in values received by write or create) or a
string (when getting the field value of a record).
Since 0c649644db0 this caused an error when user_domain was not empty.
This commit solves it by having _get_challenger_users always receiving a
string.
opw-708177
Diffstat (limited to 'addons/gamification')
| -rw-r--r-- | addons/gamification/models/challenge.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/addons/gamification/models/challenge.py b/addons/gamification/models/challenge.py index d3b0b0d5983..8a1b02d65fe 100644 --- a/addons/gamification/models/challenge.py +++ b/addons/gamification/models/challenge.py @@ -7,6 +7,7 @@ from datetime import date, timedelta from dateutil.relativedelta import relativedelta, MO from odoo import api, models, fields, _, exceptions +from odoo.tools import ustr from odoo.tools.safe_eval import safe_eval _logger = logging.getLogger(__name__) @@ -158,7 +159,7 @@ class Challenge(models.Model): """Overwrite the create method to add the user of groups""" if vals.get('user_domain'): - users = self._get_challenger_users(vals.get('user_domain')) + users = self._get_challenger_users(ustr(vals.get('user_domain'))) if not vals.get('user_ids'): vals['user_ids'] = [] @@ -169,7 +170,7 @@ class Challenge(models.Model): @api.multi def write(self, vals): if vals.get('user_domain'): - users = self._get_challenger_users(vals.get('user_domain')) + users = self._get_challenger_users(ustr(vals.get('user_domain'))) if not vals.get('user_ids'): vals['user_ids'] = [] |
