as you can see here my class in python
class recrutement(osv.osv):
_name = "recrutement"
_decription = "recrutement"
_columns = {
'name' :fields.char ( 'رقم المقرر ' ,size=64, required=False, select=True),
'nom_cand' :fields.many2one ('hr.employee','اسم الموظف' ,size=64, required=False, select=True),
'date_recrutement':fields.date("تاريخ التنصيب",required=True),
'state': fields.selection([('draft', 'recrutement-Brouillon'),('confirm', 'CSPI'),
('state3', 'SG'), ('state4', 'Directeur'), ('state5', 'Secrétaire Général'), ('state6', 'Directeur')],
'Etat', readonly=True, track_visibility='onchange', copy=False),}
output: my output
what I want to do is a function in python to stop the insertion if the second attribute does exist, in another way: ('name' Rec00.. )can have only one ('nom_cand' bouzoudja ) and 'nom_cand' can't have more than one name (Rec005, Rec006, ...)
You can use sql constraints for that.