diff --git a/company.py b/company.py
index 529b63088f..f43b59dd72 100644
--- a/company.py
+++ b/company.py
@@ -30,13 +30,11 @@ class Company(ModelSQL, ModelView):
@classmethod
def __setup__(cls):
super(Company, cls).__setup__()
- cls._constraints += [
- ('check_recursion', 'recursive_companies'),
- ]
- cls._error_messages.update({
- 'recursive_companies': (
- 'You can not create recursive companies!'),
- })
+
+ @classmethod
+ def validate(cls, companies):
+ super(Company, cls).validate(companies)
+ cls.check_recursion(companies)
@classmethod
def copy(cls, companies, default=None):
diff --git a/company.xml b/company.xml
index 9891cdfba0..cf540e9ad2 100644
--- a/company.xml
+++ b/company.xml
@@ -391,5 +391,15 @@ this repository contains the full copyright notices and license terms. -->
party.party,-1
+
+
+ company.company
+ en_US
+ error
+ recursion_error
+ Recursion error: Company "%(rec_name)s" with parent "%(parent_rec_name)s" was configured as ancestor of itself.
+ company
+
+