Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to add a custom search field in sale order tree view for my custom module..need help

By
Odoo
on 7/15/14, 5:50 AM 746 views

Hi,

I need to create an xml file for search view of status_id  from my custom filed in sale order  tree view.

  _columns={
             'status_id':fields.selection([('hold','Hold'),
                            ('back orderd','Back Order')], 'State ',required=True),
              }

Here status_id is my custom field..how to write 

search field is  status_id ,how to write <search > tag

##########################

 

 <record id="search_sale_order_ept" model="ir.ui.view">
                 <field name="name">search_sale_order_ept</field>
                 <field name="model">sale.order</field> 
                 <field name="type">search</field> 
                 <field name="inherit_id" ref="sale.view_sales_order_filter"/> 

                    <filter  string="Hold" domain="[('state','=','hold')]" help="Hold" name='filter_hold'/>
                    <filter string="Back Order" domain="[('state','=','back_order')]" help="Back Order" name='filter_backorder'/>

                 </field># This tag makes an error 

</record>

ERROR-----------------

File "lxml.etree.pyx", line 2773, in lxml.etree._Validator.assert_ (src/lxml/lxml.etree.c:113335) AssertionError: Did not expect element filter there, line 22

1

Hello Libu,

Here is an example of adding your field to the search view. Make sure you have "status_id" field in tree view.

 <record id="search_sale_order_ept" model="ir.ui.view">
                 <field name="name">search_sale_order_ept</field>
                 <field name="model">sale.order</field> 
                 <field name="type">search</field> 
                 <field name="inherit_id" ref="sale.view_sales_order_filter"/> 

                             <field name="name" position="after">

                    <filter  string="Hold" domain="[('state','=','hold')]" help="Hold" name='filter_hold'/>
                    <filter string="Back Order" domain="[('state','=','back_order')]" help="Back Order" name='filter_backorder'/>

                 </field>

</record>

Regards

 

Thanks Hiren ..wl check..

Odoo
on 7/15/14, 6:19 AM

Its not working... error when i write this code .one extra tag in your code

Odoo
on 7/15/14, 7:18 AM

@Libu - I have edited the code above please check it now

Hiren Vora - CEO at Emipro Technologies Pvt. Ltd. India
on 7/15/14, 8:34 AM
0

Koffi KPONOUGLO

--Koffi KPONOUGLO--
768
| 5 2 6
Lomé, Togo
--Koffi KPONOUGLO--

Koffi KPONOUGLO

Koffi KPONOUGLO
On 7/15/14, 9:49 AM

 

I this you put already the field status_id in the tree view.

So Try this

 <record id="search_sale_order_ept" model="ir.ui.view">
                 <field name="name">search_sale_order_ept</field>
                 <field name="model">sale.order</field> 
                 <field name="type">search</field> 
                 <field name="inherit_id" ref="sale.view_sales_order_filter"/> 

                             <field name="name" position="after">

                    <filter  string="Hold" domain="[('status_id','=','hold')]" help="Hold" name='filter_hold'/>
                    <filter string="Back Order" domain="[('
status_id','=','back_order')]" help="Back Order" name='filter_backorder'/>

                 </field>

</record>

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/15/14, 5:50 AM
Seen: 746 times
Last updated: 3/16/15, 8:10 AM