diff --git a/modules/company/company.py b/modules/company/company.py index a59516ceeb..b623ceca86 100644 --- a/modules/company/company.py +++ b/modules/company/company.py @@ -72,6 +72,15 @@ class Company(ModelSQL, ModelView): help="Uses the first identifier that matches the criteria.\n" "If none match, uses the party's tax identifier.") + @classmethod + def __setup__(cls): + super().__setup__() + t = cls.__table__() + cls._sql_constraints += [ + ('party_unique', Unique(t, t.party), + 'company.msg_company_party_unique'), + ] + @property def header_used(self): return Template(self.header or '').safe_substitute(self._substitutions) diff --git a/modules/company/message.xml b/modules/company/message.xml index f69d76290c..0a2d5732fb 100644 --- a/modules/company/message.xml +++ b/modules/company/message.xml @@ -3,6 +3,9 @@ this repository contains the full copyright notices and license terms. --> + + A party can only be assigned to one company. + The size of cached company logo must be unique.