跳至內容
選單
此問題已被標幟
1 回覆
1252 瀏覽次數

I see in the sales module, in the sale_order_line notebook, there are 3 buttons. "Add a product", "Add a section", and "Add a note".


I want to create something similar with custom method in my module but I can't find any method that defines "add_product_control", "add_section_control", or "add_note_control".



頭像
捨棄
最佳答案

Hi,

Please Use widget="section_and_note_one2many" in your One2many field in XML,

To Get Section and Note in Your Custom Model

and after applying it you can add the control


<field name="your_one_2_many_field"

widget="section_and_note_one2many"

      <tree editable="bottom" string="Journal Items">

       <control>

           <create name="add_line_control" string="Add a line"/>

<create name="add_section_control" string="Add a section" context="{'default_display_type': 'line_section'}"/>

<create name="add_note_control" string="Add a note" context="{'default_display_type': 'line_note'}"/>

       </control>

      // Add you custom fields

</tree>

</field>


Hope it helps

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
5
9月 25
22362
3
8月 25
3270
1
5月 25
3131
1
4月 25
4099
1
4月 25
4963