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

Usage of Search Attribute in field tag in openerp7

By
vivek
on 8/26/13, 7:51 AM 2,072 views

Can anyone tell me the use of search attribute in field tag.

Sample from the documentation is below

<field name="partner_id" search="[]" model="res.partner"/>

Sample from the openerp code is below

 <field name="fields_id" search="[('model','=','res.partner'),('name','=','property_account_receivable')]"/>  # account/demo/account_minimal.xml

 <field model="res.country.state" name="state_id" search="[('code','ilike','ca')]"/> # base/res/res_partner_demo.xml

 <field name="account_debit" search="[('code', 'like', '4540%')]"/> # l10n_be_hr_payroll_account/l10n_be_hr_payroll_account_data.xml

Documentation Explanation is below

The search attribute allows to find the record to associate when you do not know its xml id. You can thus specify a search criteria to find the wanted record. The criteria is a list of tuples of the same form than for the predefined search method. If there are several results, an arbitrary one will be chosen (the first one)

I am having some prob in understanding how all the above works. Can anyone help me out how this needs to be used. Is it possible to give dynamic search values from the global filter. Thanks for your time.

1

Thierry Godin

--Thierry Godin--
1516
| 8 7 8
Collegien, France
--Thierry Godin--

..

Thierry Godin
On 8/26/13, 7:58 AM

Hello,

Search attribute is like SQL WHERE statement .

ie : search="[('code','ilike','ca')]" means SELECT .... WHERE code ILIKE 'ca'

so that will get records where code = CA, or code =ca, code= Ca or code= cA

Best regards

:) I am sorry Thierry, that's not wt i've asked. I asked what is the use of that search tag and where it exactly makes a difference in openerp7. Hope you understand. Looking for your guidance. Thanks

vivek
on 8/26/13, 8:02 AM

Sorry vivek, I've not undertood what you wanted. (my native language is french)

Thierry Godin
on 8/26/13, 8:10 AM

no prob, i immediately understood when looking at your profile and posts. Anyway thanks for your support.

vivek
on 8/26/13, 8:12 AM

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

0 follower(s)

Stats

Asked: 8/26/13, 7:51 AM
Seen: 2072 times
Last updated: 3/16/15, 8:10 AM