Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
4 Odpowiedzi
12195 Widoki

whenever I tried to import xls file to create employees. This error occurs.

  • insert or update on table "hr_employee" violates foreign key constraint "hr_employee_resource_id_fkey" DETAIL: Key (resource_id)=(370) is not present in table "resource_resource". at row 2
Awatar
Odrzuć
Najlepsza odpowiedź

I had the same problem and I solved it by adding Resource Column to the imported table, and checked the option "create if not existed" while importing. it wasn't the resource record duplicated, actually the record doesn't exist and that's the problem.

Just sharing it for the people who may face the same problem.

Awatar
Odrzuć

Hi. I did the same as you and it works fine. There´s a little detail though. When I imported employees I assigned the same name to the resource as to the employee which is the default behavior. The problem came when I realized that having thousands of employees, more than one employee had their names repeated. In this case I ended up with more than one employee pointing to the same resource since odoo assigned the employee to the existing resource. I ended up making the employee name unique to solve this. Cheers

you may have a screenshot how the columns should looks like. ?

Najlepsza odpowiedź

Hi  Hunain,

I think this video can help you:

https://www.youtube.com/watch?v=VMJ0UI1crz4&list=PLSKcWRTtEl5qzvRaI-VTGavfReiHS_EEb&index=3

Awatar
Odrzuć
Najlepsza odpowiedź

This error occurs if exists repeated External ID in import file. Check all External IDs are unique. 

Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

Seems that importing data is referring to a record in the model resource.resource and that record with the given ID is not existing in the database. So Check the database and see whether there is a record present in the given ID.

Activate the developer mode and navigate to Settings -> Technical -> Resource -> Resources and check for the record existence.


For getting the sample import template of the Employees in odoo12,


Thanks

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
paź 23
97
2
wrz 21
2999
2
lip 19
6765
2
maj 25
1313
4
maj 25
5000