Make each company's party unique

This commit is contained in:
Cédric Krier
2025-10-01 10:17:22 +02:00
parent 90ded6b681
commit f32669b086
2 changed files with 12 additions and 0 deletions
+9
View File
@@ -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)
+3
View File
@@ -3,6 +3,9 @@
this repository contains the full copyright notices and license terms. -->
<tryton>
<data>
<record model="ir.message" id="msg_company_party_unique">
<field name="text">A party can only be assigned to one company.</field>
</record>
<record model="ir.message" id="msg_company_logo_cache_size_unique">
<field name="text">The size of cached company logo must be unique.</field>
</record>