跳至内容
菜单
此问题已终结
2 回复
1549 查看

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?

形象
丢弃
最佳答案

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

形象
丢弃
相关帖文 回复 查看 活动
0
5月 25
885
1
4月 25
1013
1
2月 24
2739
0
10月 24
4047
0
11月 22
2249