Adding the code to create the rush order filter

The code segment will naturally be added to the silkworm_view.xml file. It will have the same record structure as our other modification. Adding this code segment and updating the module will implement the change we want:

<record id="sale_view_sales_order_filter" model="ir.ui.view"> 
    <field name="name">sale.order.search</field> 
    <field name="model">sale.order</field> 
    <field name="inherit_id" ref="sale.view_sales_order_filter"/> 
    <field name="arch" type="xml"> 
      <field name="name" position="after"> 
        <filter name="rush" string="Rush Only" 
domain="[('rush','=',True)]"/> </field> </field> </record>

Let's look at some of the more important elements of this code segment. It follows a similar structure to the modification that added fields to our form. What is most important when looking at the code in any module is to identify the inherit_id field's ref value. This is what ties your view modifications to the view in the base module.

In this case, our inherit_id is sale.view_sales_order_filter.

Use Developer Mode to look up the view name from inside Odoo. Navigate to the view you want to work with and, in the developer menu, you can choose the manage view to see the External ID of the view. You can also use Developer Mode to quickly look at the syntax of views and use them to help you determine how your filters should be structured.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.199.182