Test coworker1 coworker2 is same
This commit is contained in:
parent
e048a9e9f0
commit
e37774fff6
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
""" Coworker relation """
|
""" Coworker relation """
|
||||||
|
|
||||||
from odoo import models, fields, api
|
from odoo import models, fields, api, _
|
||||||
|
from odoo.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
class CoworkerRelation(models.Model):
|
class CoworkerRelation(models.Model):
|
||||||
"""Coworker relation model """
|
"""Coworker relation model """
|
||||||
@ -21,3 +23,10 @@ class CoworkerRelation(models.Model):
|
|||||||
domain="[('coworker_type', 'in', ['staffer', 'member', 'worker', 'volunteer', 'visitor'])]"
|
domain="[('coworker_type', 'in', ['staffer', 'member', 'worker', 'volunteer', 'visitor'])]"
|
||||||
)
|
)
|
||||||
relation = fields.Char(index=True, required=True)
|
relation = fields.Char(index=True, required=True)
|
||||||
|
|
||||||
|
|
||||||
|
@api.constrains('coworker1', 'coworker2')
|
||||||
|
def _check_if_coworker_is_same(self):
|
||||||
|
"""Test si coworker1 est identique à coworker2"""
|
||||||
|
if not self.coworker1 != self.coworker2:
|
||||||
|
raise ValidationError(_('Coworker1 is same coworker2'))
|
||||||
|
Loading…
Reference in New Issue
Block a user