[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:
RomainLibert
2018-02-23 16:13:03 +01:00
parent 7b322d08de
commit ffbee8882e
+3 -2
View File
@@ -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):