diff options
| author | Victor Feyens <vfe@odoo.com> | 2020-06-19 13:24:57 +0000 |
|---|---|---|
| committer | Victor Feyens <vfe@odoo.com> | 2020-06-19 13:27:41 +0000 |
| commit | bdcad21ccc3b9ff5110230440eb2aa5e18e13ffa (patch) | |
| tree | 14dc465fc0417f5f4262fb9afb0ca10307b98cc1 /addons/website_forum/models | |
| parent | 630beba02eac72626e4bea1c0f4d81e17c2fec3e (diff) | |
[FIX] *: correct support of multi records in methods
Wrong usage of self in for loops makes some apparently multi-friendly
methods not work correctly when called with a recordset of len > 1.
This commit replaces those references by the correct unique record
reference which should be used at this iteration of the loop, avoiding
potential exceptions or wrong behavior in the concerned methods.
closes odoo/odoo#53320
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Diffstat (limited to 'addons/website_forum/models')
| -rw-r--r-- | addons/website_forum/models/forum.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/addons/website_forum/models/forum.py b/addons/website_forum/models/forum.py index abe6d4c39da..4c3adede878 100644 --- a/addons/website_forum/models/forum.py +++ b/addons/website_forum/models/forum.py @@ -976,16 +976,16 @@ class Vote(models.Model): values.pop('user_id', None) for vote in self: - self._check_general_rights(values) + vote._check_general_rights(values) if 'vote' in values: if (values['vote'] == '1' or vote.vote == '-1' and values['vote'] == '0'): upvote = True elif (values['vote'] == '-1' or vote.vote == '1' and values['vote'] == '0'): upvote = False - self._check_karma_rights(upvote) + vote._check_karma_rights(upvote) # karma update - self._vote_update_karma(vote.vote, values['vote']) + vote._vote_update_karma(vote.vote, values['vote']) res = super(Vote, self).write(values) return res |
