콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
3808 화면

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

아바타
취소
베스트 답변

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

아바타
취소
작성자

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 :)

관련 게시물 답글 화면 활동
2
12월 20
8488
1
10월 23
3189
2
4월 23
3105
1
3월 23
2621
2
2월 25
41041