[FIX] web_translate_dialog: Search using '=' to target right field

Without this commit, ir.translation are searched using a LIKE,
meaning that for a field called 'title', we'd get the translations
of all the fields beginning with title on this model.
Therefore, the returned value for field 'title' that is displayed
in the widget will be the value of the last result returned by
search_read, what could be anything beginning with title, and not
necessarily the field title itself.
This commit is contained in:
Akim Juillerat
2020-06-02 15:20:52 +02:00
parent ed9b35f36d
commit aef961add1

View File

@@ -25,7 +25,7 @@ class BaseModel(models.BaseModel):
for name in field_names:
tr_read_res = self.env['ir.translation'].search_read([
('name', 'like', '%s,%s' % (self._name, name)),
('name', '=', '%s,%s' % (self._name, name)),
('res_id', '=', rec_id),
('lang', '!=', 'en_US')
])