From 22cbe8bf3d1d834a93ce32c6b25ab79ec8bead09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 3 Oct 2021 13:45:32 +0200 Subject: [PATCH] Add test on domain of relation fields issue10794 review383081002 --- production.py | 10 +++++----- stock.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/production.py b/production.py index 7ece38dd56..eab0afa3fb 100644 --- a/production.py +++ b/production.py @@ -122,8 +122,8 @@ class Production(ShipmentAssignMixin, Workflow, ModelSQL, ModelView): inputs = fields.One2Many('stock.move', 'production_input', 'Inputs', domain=[ ('shipment', '=', None), - ('from_location', 'child_of', [Eval('warehouse')], 'parent'), - ('to_location', '=', Eval('location')), + ('from_location', 'child_of', [Eval('warehouse', -1)], 'parent'), + ('to_location', '=', Eval('location', -1)), ('company', '=', Eval('company', -1)), ], states={ @@ -134,10 +134,10 @@ class Production(ShipmentAssignMixin, Workflow, ModelSQL, ModelView): outputs = fields.One2Many('stock.move', 'production_output', 'Outputs', domain=[ ('shipment', '=', None), - ('from_location', '=', Eval('location')), + ('from_location', '=', Eval('location', -1)), ['OR', - ('to_location', 'child_of', [Eval('warehouse')], 'parent'), - ('to_location.waste_warehouses', '=', Eval('warehouse')), + ('to_location', 'child_of', [Eval('warehouse', -1)], 'parent'), + ('to_location.waste_warehouses', '=', Eval('warehouse', -1)), ], ('company', '=', Eval('company', -1)), ], diff --git a/stock.py b/stock.py index a7baefca3a..db418eaf91 100644 --- a/stock.py +++ b/stock.py @@ -23,7 +23,7 @@ class Location(metaclass=PoolMeta): }, domain=[ ('type', '=', 'storage'), - ('parent', 'child_of', [Eval('id')]), + ('parent', 'child_of', [Eval('id', -1)]), ], depends=['type', 'id'], help="Where the production components are picked from.\n" @@ -35,7 +35,7 @@ class Location(metaclass=PoolMeta): }, domain=[ ('type', '=', 'storage'), - ('parent', 'child_of', [Eval('id')]), + ('parent', 'child_of', [Eval('id', -1)]), ], depends=['type', 'id'], help="Where the produced goods are stored.\n"