콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
3558 화면

I'm creating a new project task to an existing project via an automated action. 

I need to assign a known value to the field projct_id in the model project.task. 

The ID of the project to assign to the field project_id in my case is = 5

I don't know the correct syntax:

env['project.task'].create({'name' :record.origin, 'project_id'  :record. ??? })

아바타
취소
베스트 답변

If you are hardcoding the value (not recommended) the syntax is

'project_id' : 5

아바타
취소
작성자

I fully agree with you that it is not a good practice to hardcode a value.

However, thsi is a case where I need to assign a specific project according to pre-determined cases specified in the automated action. Do you know any condition for which the ID change once the record is created in the database?

The id will never change after the record is created.

관련 게시물 답글 화면 활동
1
11월 23
2159
2
12월 23
5779
1
11월 22
2615
1
8월 22
2657
2
1월 22
5859