From d4d0cb4841197c548c70e8592985de62113a42eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 18 Apr 2016 15:12:11 +0700 Subject: [PATCH] Add domain on parent The parent of subdivision must be in the same country. issue5483 review17251002 --- country.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/country.py b/country.py index b34398a2eb..26f07674e3 100644 --- a/country.py +++ b/country.py @@ -184,7 +184,11 @@ class Subdivision(ModelSQL, ModelView): ('unitary authority (wales)', 'Unitary authority (wales)'), ('zone', 'zone'), ], 'Type', required=True) - parent = fields.Many2One('country.subdivision', 'Parent') + parent = fields.Many2One('country.subdivision', 'Parent', + domain=[ + ('country', '=', Eval('country', -1)), + ], + depends=['country']) @classmethod def __setup__(cls):