Hello.. Anyone have any idea how we can pass data in many2one field which is inside the one2many field..
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilidad
- Inventario
- PoS
- Project
- MRP
Se marcó esta pregunta
Hi,
Please try like this:
result= self.env['account.move'].create({
'partner_id': self.partner_a.id,
'move_type': 'out_invoice',
'invoice_line_ids': [(0, 0, {
'name': 'test line',
'price_unit': 66.0,
'quantity': quantity,
'discount': 0.0,
'product_uom_id': product.uom_id.id,
'product_id': product.id,
})],
})
Here, it is creating a record inside account.move, where invoice_line_ids is a one2many field in the model account.move and product_id, product_uom_id are many2one fields in the one2many lines(invoice_line_ids).
----------UPDATE--------------
You can do it like this for passing value to task_id in each line,
for rec in self.project_detail_ids:
# do something
rec.task_id = task_obj.id
It is iterating through each line in project_line_ids.Where, task_obj is a record from the add task table(which may be taken by doing your logic before passing the value to the task_id field in the particular line).
Regards
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
Registrarse
Hello Cybrosys Techno Solutions Pvt.Ltd thanks for your reply but i have one2many field called project_detail_ids inside this i have one field called task_id which is many2one field of add task table i want to insert data for that use have any idea how i can do that ?
Hi,
We have made an update in code, please check