I created three classes like , ali_khan with an id ( 'ali_ids':fields.one2many('ali.khan', 'chbc_id', 'Ali khan'),, test_chbc and test_destitute. i referred that id in the rest two classes . i can add and delete records to tes_chbc but each time i try to add a record to test_destitute i get an integrity error.. my code:
class ali_khan(osv.osv):
_name="ali.khan"
_description="Does any member of the household have regular paid employment"
_columns={
'destitute_ids':fields.many2one('test.destitute',reuired=True),
'chbc_id':fields.many2one('test.chbc', required=True),
'person_name':fields.char('Name of Person'),
'work_type':fields.char('Type of work'),
'income_monthly':fields.char('Monthly Income'),
'com_confirm':fields.char('Communal Confirmation'),
}
ali_khan()
class test_chbc(osv.osv):
_name="test.chbc"
_columns={
'ali_ids':fields.one2many('ali.khan', 'chbc_id', 'Ali khan'),
'first_name':fields.char('First Name',size=64),
'family_name':fields.char('Family Name',size=64),
'no_id':fields.boolean('No ID'),
'id_num':fields.char('ID Number',size=64), #with a lable of ID Number yes/no
'sex':fields.selection(gender_lov,'Sex',size=64),
'date_o_birth':fields.date('Date of birth',size=64),
}
test_chbc()
class test_destitute(osv.osv): _name="test.destitute" _columns={ 'ali_ids':fields.one2many('ali.khan', 'destitute_ids', 'Khan'), 'first_name':fields.char('First Name',size=64), 'family_name':fields.char('Family Name',size=64), 'id_num':fields.char('ID Number',size=64), #with a lable of ID Number yes/no 'sex':fields.selection(gender_lov,'Sex',size=64), 'date_o_birth':fields.date('Date of birth',size=64), 'formal_edu':fields.char('Formul Education',size=64), 'qualification':fields.char('Qualification',size=64), 'place_o_birth':fields.char('Place of Birth',size=64), 'tel_home':fields.char('Home Telephone',size=64), 'cell_numb':fields.char('Cell Number',size=64),
}
test_destitute()
The operation cannot be completed, probably due to the following: - deletion: you may be trying to delete a record while other records still reference it - creation/update: a mandatory field is not correctly set. [object with reference: chbc_id-chbc.id]