Hi,
I have added a button that when clicked, it should create multiple employees from my custom module.
Kindly help me with this, thanks
Hi,
I have added a button that when clicked, it should create multiple employees from my custom module.
Kindly help me with this, thanks
Hi,
This can be easily done by passing list of values to the create method.
Suppose if i need to create a record with name only in model_xyz, first prepare a list of dictionary as follows:
vals_list = [{'name': 'test 1'}, {'name': 'test 2'}]
then pass this created list to create orm method.
self.env['model.xyz'].create(vals_list)
Thanks
Hello Sasha Brown,
Please find below code it may help you to resolve this issue
Please find code in comment.
I Hope this will help you.
Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari
suppose you have one button(create_empoyee) in your custom module.This code added in your custom module.
def create_employee(self):
for rec in self.search([]):
Suppose you create employee record with name so Fist you create list of dictionary.
vals = ({field_name: rec.your_custom_model_field})
After this vals is passed to create function.
self.env['model.employee'].create(vals)
Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !
S'inscrire| Publications associées | Réponses | Vues | Activité | |
|---|---|---|---|---|
|
0
mars 26
|
16 | |||
|
Timesheet App in backoffice
Résolu
|
2
mars 26
|
3025 | ||
|
2
oct. 25
|
4928 | |||
|
1
sept. 25
|
4582 | |||
|
3
juil. 25
|
5783 |
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.