diff --git a/trytond/osv/orm.py b/trytond/osv/orm.py index 50a2169211..7d80ec7cca 100644 --- a/trytond/osv/orm.py +++ b/trytond/osv/orm.py @@ -2519,8 +2519,11 @@ class ORM(object): return order_by, tables, clause if field_name: - if '%s' in field_name: - order_by.append(field_name % table_name + ' ' + otype) + if '%(table)s' in field_name or '%(order)s' in field_name: + order_by.append(field_name % { + 'table': table_name, + 'order': otype, + }) else: order_by.append(table_name + '.' + field_name + ' ' + otype) return order_by, tables, clause