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.

1

How to give field as value in domain in odoo9.0?

By
madan
on 6/10/16, 4:39 AM 284 views

I have written this code here

'name_job_card_flow' is a field name so whatever value inside this field that should display.But here it is treating as string then it is matching the values which is equal to string like 'name_job_card_flow'

so anyone here help me how to give field name as a value in search domain?

res=self.env['vehicle.time.card.table'].search([('name_job_card_flow_id.name_job_card_flow','i=','name_job_card_flow')])

 

1

Prakash Sharma

--Prakash Sharma--
815
| 2 1 4
Delhi, India
--Prakash Sharma--

I like to surround myself with brave, creative people.

My motivation for learning different technologies and algos drive me. I love challenges of a steep learning curve which I believe makes me a better learner. I have a strong desire to learn different technologies, which would enable me to become a full stack developer.

Prakash Sharma
On 6/10/16, 12:54 PM

There are two way

Create a related field name_job_card_flow in model  vehicle.time.card.table as Below

name_job_card_flow =fields.Char(related = 'name_job_card_flow_id.name_job_card_flow',store=1)

And make the search query :

res=self.env['vehicle.time.card.table'].search([('name_job_card_flow','i=','name_job_card_flow')])

Or  Use filtered :

domain=[]
card_tables=self.env['vehicle.time.card.table'].search(domain)
res=card_tables.filtered(lambda table:
table.name_job_card_flow_id.name_job_card_flow
!=='name_job_card_flow' )


Hope i may help in your case.

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: 6/10/16, 4:39 AM
Seen: 284 times
Last updated: 6/13/16, 1:10 AM