2017-03-21 9 views
0

나는 Odoo V9에서 employees.csv 및 departments.csv 파일을 가져 오려고합니다. Employees에는 부서의 고유 ID (Odoo 문서 당 외부 ID에 매핑 된 ID)를 참조하는 열이 있습니다. Departments에서 고유 한 부서를 매핑 할 때 "External ID"를 내 필드로 선택하고 Employees에서 "Departments/External ID"를 선택합니다. employees.csv의 유효성을 검사 할 때 다음과 같이 표시됩니다.고유 식별자 (외부 ID)를 사용하여 관련 레코드 가져 오기

insert or update on table "hr_employee" violates foreign key constraint "hr_employee_department_id_fkey" DETAIL: Key (department_id)=(1470) is not present in table "hr_department". at row 18 (3 more) 
insert or update on table "hr_employee" violates foreign key constraint "hr_employee_department_id_fkey" DETAIL: Key (department_id)=(1471) is not present in table "hr_department". at row 30 (7 more) 
insert or update on table "hr_employee" violates foreign key constraint "hr_employee_department_id_fkey" DETAIL: Key (department_id)=(1473) is not present in table "hr_department". at row 32 (15 more) 
insert or update on table "hr_employee" violates foreign key constraint "hr_employee_department_id_fkey" DETAIL: Key (department_id)=(1472) is not present in table "hr_department". at row 392 (8 more) 
insert or update on table "hr_employee" violates foreign key constraint "hr_employee_department_id_fkey" DETAIL: Key (department_id)=(1475) is not present in table "hr_department". at row 405 (1 more) 

department_id의 출처를 모르겠습니다. 그들은 내가 가져온 외부 ID가 아닙니다. 이 문제는 다른 관련 레코드도 가져 오는 중입니다. 이것은 예시하기 가장 쉬운 방법이었습니다.

편집 : I 뭔가를 알아 냈습니다. 각 고유 ID는 현재 파일뿐만 아니라 모든 파일에서 고유해야합니다.

Missing required value for the field 'First' (name) at row 5

: 나는 다른 오류에 충돌했기 때문에 대신 1의, 2, 3 ... 내가 그들에게 dept_1, dept_2, dept_3을 변경했습니다 ... 나는 아직도 내 이론을 테스트 할 수 아니에요

행에 누락 된 값이 있더라도.

답변

0

실제로 고유 식별자는 모든 모델에서 고유해야합니다. 따라서 departments.csv가 1, 2, 3을 고유 ID로 사용하는 경우 employees.csv에서 1, 2, 3을 사용할 수 없습니다. dept_1, dept_2, dept_3 ...으로 변경했습니다. emp_1, emp_2, emp_3 ... 그리고 그 트릭을!