[FIX] rating: Fix minor bug in write method
It shouldn't happen, but if we change the name of multiple rating_mixin inheriting models, we can run into an error, because write doesn't support multiple values.
This commit is contained in:
@@ -163,8 +163,9 @@ class RatingMixin(models.AbstractModel):
|
||||
def write(self, values):
|
||||
""" If the rated ressource name is modified, we should update the rating res_name too. """
|
||||
result = super(RatingMixin, self).write(values)
|
||||
if self._rec_name in values:
|
||||
self.rating_ids._compute_res_name()
|
||||
for r in self:
|
||||
if r._rec_name in values:
|
||||
r.rating_ids._compute_res_name()
|
||||
return result
|
||||
|
||||
def unlink(self):
|
||||
|
||||
Reference in New Issue
Block a user