Hi,

I came across an odd error message and figured out what was causing
it. The cause turned out to be weird enough to make me write this
e-mail and ask if this is intended behavior or not.

Turns out that if you have two objects (let's say Car and Owner) with
the Car having a Many2One relationship with the Owner.
The Owner has a "name" field, which is a fields.Function for good reasons.
The Car's __init__ also has this line: self._order.insert(0, ('owner', 'ASC'))

When you now open the Car's list view, you get the following or similar error:

Exception calling method search on model kriso.car from 1@::1:42236/trytest01:
Traceback (most recent call last):
  File "/home/elver/dev/tryton/trytond/trytond/protocols/dispatcher.py",
line 127, in dispatch
    res = getattr(obj, method)(cursor, user, *args, **kargs)
  File "/home/elver/dev/tryton/trytond/trytond/model/modelsql.py",
line 1172, in search
    field, otype, context=context)
  File "/home/elver/dev/tryton/trytond/trytond/model/modelsql.py",
line 1872, in _order_calc
    user, field_name, otype, context=context)
  File "/home/elver/dev/tryton/trytond/trytond/model/modelsql.py",
line 2045, in _order_calc
    raise Exception('Error', 'Wrong field name (%s) in order!' % field)
Exception: ('Error', 'Wrong field name (name) in order!')

Is this intended behavior? Is it simply not possible to have the
primary name field of some object computed by a function?

Best,
Elver

[email protected]
+372 5661 6933
http://elver.wordpress.com/
skype: elver.loho

-- 
[email protected] mailing list

Reply via email to