Permalink
Browse files

[FIX] rating: Send rating if no override of rating_get_parent

Purpose
=======

Currently if the method rating_get_parent is not overriden, then
sending a rating on a record of the model leads to a traceback.
  • Loading branch information...
tivisse authored and RomainLibert committed Sep 14, 2018
1 parent c8441a6 commit eb11665bfcede0555f9b0d5f20422d2827596e56
Showing with 5 additions and 3 deletions.
  1. +5 −3 addons/rating/models/rating.py
@@ -106,9 +106,11 @@ def _find_parent_data(self, values):
'parent_res_id': False,
}
if hasattr(current_record, 'rating_get_parent'):
parent_res_model = getattr(current_record, current_record.rating_get_parent())
data['parent_res_model_id'] = self.env['ir.model']._get(parent_res_model._name).id
data['parent_res_id'] = parent_res_model.id
current_record_parent = current_record.rating_get_parent()
if current_record_parent:
parent_res_model = getattr(current_record, current_record_parent)
data['parent_res_model_id'] = self.env['ir.model']._get(parent_res_model._name).id
data['parent_res_id'] = parent_res_model.id
return data
@api.multi

0 comments on commit eb11665

Please sign in to comment.