Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Creating Search View in Openerp

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 808
    Comment on it

    Search views are very useful when it comes to exact data requirement. In OpenERP we can create such views very easily and quickly, just adding the few line of code in your view. You can add as many fields you wish and add buttons that do some sorting just by a click on them. OpenERP search views do all of them.

    I am creating a very small search view here in my account invoice page with some search buttons and fields.

    <record id="view_account_invoice_filter" model="ir.ui.view">
                <field name="name">account.invoice.select</field>
                <field name="model">account.invoice</field>
                <field name="type">search</field>
                <field name="arch" type="xml">
                    <search string="Search Invoice">
                       <group>
                            <filter name="draft" icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Invoices"/>
                            <filter name="proforma" icon="terp-gtk-media-pause" string="Proforma" domain="[('state','=','proforma2')]" help="Proforma Invoices"/>                            
                            <separator orientation="vertical"/>
                            <filter name="unpaid" icon="terp-dolar_ok!" string="Unpaid" domain="[('state','=','open')]" help="Unpaid Invoices"/>
                            <separator orientation="vertical"/>                            
                            <field name="partner_id"/>            
                            <field name="user_id" widget="selection" string="Salesman">
    
                            </field>
                       </group>
                   </search>
    

    Explanation:

    <filter name="draft" icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Invoices"/> 
    

    adds a button like filter on the view that searches all the invoices that are in Draft state,

    domain attribute describes the criteria for the search,

    icon attribute adds an image on the button,

    name attribute is the name of the field,

    string attribute for the Name to be displayed on the view.

    <field name="partner_id"/>
    

    adds simply a box where partner name can be entered and all his invoices will be searched.

    <field name="user_id" widget="selection" string="Salesman">
    

    adds a drop down list by widget attribute for the Salesman.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: