'Odoo Custom Tree Control

If you create new quotation in the Sales module, there are some control buttons:

  • Add a product
  • Add a section
  • Add a note

enter image description here

I want to create those custom control for my tree view. But when I search from the source code, I can't find where is the python method is called.

...
<tree string="Sales Order Lines" editable="bottom">
    <control>
        <create name="add_product_control" string="Add a product"/>
        <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>
...

I search the add_product_control keyword, but there is nothing I found.



Solution 1:[1]

Because odoo is not calling any python method it will trigger from javascript side and it will add new record and hide other fields using display_type display-types

  1. line_section
  2. line_note

and you can find code in /addons/account/static/src/js/section_and_note_fields_backend.js

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ravi Ponkia