Make each company's party unique
This commit is contained in:
@@ -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,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>
|
||||
|
||||
Reference in New Issue
Block a user