Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
3613 Näkymät

hi,

i want to create a master-detail form for data entry (like: Departments and Employees, the key column: id in Department (One2Many) and in Employee it is department_id (Many2One)), please point me to a simple example which uses only custom models and custom view.

regards

Avatar
Hylkää
Paras vastaus

Hi,

To add a one2many field in odoo, you can refer this video explaining the same in details, see: How to Add One2many Fields In Odoo

Example:

class HRDepartment(models.Model):
_inherit = 'hr.department'

employee_ids = fields.One2many('hr.employee', 'department_id', string='Employees')


class HREmployee(models.Model):
_inherit = 'hr.employee'

department_id = fields.Many2one('hr.department', string='Department')


Thanks

Avatar
Hylkää
Tekijä

thanks for help, but how i can use in a Master-Detail view (xml) which relatively done DML operations and Detail portion should be a editable tree view. also thanks for video link :)

Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
2
jouluk. 20
8321
1
lokak. 23
2980
2
huhtik. 23
2874
1
maalisk. 23
2406
2
helmik. 25
40670