Skip to Content
Menu
This question has been flagged
1 Reply
5458 Views

I  would like to update

address_id = fields.Many2one ( comodel_name = 'res.partner' )

to  the following:

address_id = fields.Many2one ( comodel_name = 'res.company' )

But  it  will raise the Following error:

insert or update on table "hr_employee" violates foreign key constraint "hr_employee_address_id_fkey"

Avatar
Discard
Best Answer

Maybe you can clean up the record on hr.employee before you update the module it, or you can just clean/set null to all record in address_id column if the column is not required  / can be null on database table.

That's errors showed up because when you try to update the database foreign key column,, there is some existing record on hr.employee wich has value on column_id then its value not exist at the new comodel table

Avatar
Discard
Related Posts Replies Views Activity
0
Dec 24
6
1
Nov 24
51
2
Sep 24
11249
2
Nov 21
9236
2
Mar 15
3783