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

How to set default value from parent form in one2many field while creating records in one2many field, before saving parent form

아바타
취소

To get parent value in one2many we may use context in XML.

Reference: https://goo.gl/XXg5D3

There is a complete guide about context hope this will helps you and others.

베스트 답변

Hi,

Using context you can achieve it.


See the sample code,

<field name="timesheet_ids" context="{'default_project_id': project_id}">
<tree editable="bottom" string="Timesheet Activities" default_order="date">
<field name="date"/>
<field name="user_id" invisible="1"/>
<field name="employee_id" required="1"/>
<field name="name"/>
<field name="unit_amount" string="Duration" widget="float_time"/>
<field name="project_id" invisible="1"/>
</tree>
</field>


Here,

context="{'default_field_in_one2many': field_in_parent}"


Thanks

아바타
취소
작성자

Thank you , it is correct

베스트 답변

How we can pass custom one2many field to sale.order.line one2many field please.?

아바타
취소
관련 게시물 답글 화면 활동
0
11월 23
1434
1
9월 23
3371
2
10월 22
21365
1
6월 22
6332
1
6월 22
3131