Search on return shipments by rec_name or id

The Reference field needs to have a dotted notation to use the forth clause.
So it should be rec_name if the value is a string and otherwise the id.

issue5291
review19211002
This commit is contained in:
Cédric Krier
2016-04-26 09:54:49 +02:00
parent bbc2d81842
commit 1dfdb34822
+5 -1
View File
@@ -578,7 +578,11 @@ class Sale(Workflow, ModelSQL, ModelView, TaxableMixin):
Search on shipments or returns
'''
def method(self, name, clause):
return [('lines.moves.shipment',) + tuple(clause[1:])
if isinstance(clause[2], basestring):
target = 'rec_name'
else:
target = 'id'
return [('lines.moves.shipment.' + target,) + tuple(clause[1:])
+ (model_name,)]
return classmethod(method)