Falle 4560: Eindeutige ID - UID
parent
6301e23338
commit
26127c96f4
|
|
@ -63,6 +63,17 @@ class Partner(models.Model):
|
||||||
('portal_id_uniq', 'unique(portal_id)', 'Die Portal-ID muss eindeutig sein')
|
('portal_id_uniq', 'unique(portal_id)', 'Die Portal-ID muss eindeutig sein')
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@api.one
|
||||||
|
@api.constrains('is_company', 'vat')
|
||||||
|
def _check_unique_vat(self):
|
||||||
|
if not self.vat or (not self.is_company and self.parent_id):
|
||||||
|
return
|
||||||
|
partners = self.search([('is_company', '=', True),
|
||||||
|
('vat', '=', self.vat),
|
||||||
|
('id', '!=', self.id)])
|
||||||
|
if partners:
|
||||||
|
raise ValidationError(_("Es sind bereits folgende Unternehmen mit der selben USt. ID vorhanden: %s") % [p.name for p in partners])
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def portal_create_partner(self, vals):
|
def portal_create_partner(self, vals):
|
||||||
vals = self.with_context(sst_1=True).remove_not_specified_fields(vals)
|
vals = self.with_context(sst_1=True).remove_not_specified_fields(vals)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue