Fix joins when ordering on ir.model.field

issue3910
review10311002
This commit is contained in:
Cédric Krier committed 2014-05-17 18:41:20 +02:00
1 parent 169b41e0b3
commit 360d1232fa
1 file changed
+15 -4
+15 -4
View File
@@ -346,11 +346,22 @@ class FieldTranslate(Field):
model = IrModel.__table__()
join = self._get_translation_join(Model, name,
translation, model, table)
tables[key] = {
None: (join.right, join.condition),
}
if join.left == table:
tables[key] = {
None: (join.right, join.condition),
}
else:
tables[key] = {
None: (join.left.right, join.left.condition),
'translation': {
None: (join.right, join.condition),
},
}
else:
translation, _ = tables[key][None]
if 'translation' not in tables[key]:
translation, _ = tables[key][None]
else:
translation, _ = tables[key]['translation'][None]
return [Coalesce(NullIf(translation.value, ''),
self.sql_column(table))]