Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
1532 Переглядів

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

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
0
трав. 25
868
1
квіт. 25
985
1
лют. 24
2708
0
жовт. 24
4015
0
лист. 22
2220