Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
3625 Lượt xem

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. ??? })

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

'project_id' : 5

Ảnh đại diện
Huỷ bỏ
Tác giả

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.

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 11 23
2176
2
thg 12 23
5804
1
thg 11 22
2639
1
thg 8 22
2678
2
thg 1 22
5892