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

I create one Module that record some action.

for this, I want to create one timesheet record as soon as this module confirm, but I don't have any idea.

can anyone help me in this process?

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

Hi,
Inside the confirm button, you can add the code to create timesheet record, what you have to do is,  prepare a dict of value and pass it to the create method of time sheet model.

vals = {'field_1': field_value, 'field_2': field_value}
self.env['account.analytic.line'].create(vals)


Sample code:

timesheet_entry = self.env['account.analytic.line'].create({
'project_id': self.project_customer.id,
'task_id': self.task1.id,
'name': 'my only timesheet',
'unit_amount': 4,
'user_id': self.user_employee.id,
})


Odoo ORM Create:   https://www.youtube.com/watch?v=n37RL_j4K3A

Thanks

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 5 25
881
1
thg 4 25
1008
1
thg 2 24
2736
0
thg 10 24
4041
0
thg 11 22
2249