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 narrow down the domain of a class based of a selection filed of this class?

By
David Arnold
on 7/7/14, 7:22 AM 532 views

class toplevel()

    _columns = { 'foo_class_field': fields.many2many('foo','ManyField') }

class foo()

   _columns = { 'bar': fields.selection(('a','one'),('b','two')) }

 

on a view I want something like 

<field name="foo_classs_field"
                               domain="[('bar', '=', 'a')]"/>

 

but this doesn't work. Any help?

Given that information I can't see why it shouldn't work.

René Schuster
on 7/7/14, 7:25 AM

Hi Rene As i suspect, the bar field doesn't contain a single 'a' value, but probably some kind of value set or just a concatenated string or something different. The documentation on this is shallow.. and from the source I din't get the wisdom... ;)

David Arnold
on 7/7/14, 1:35 PM

What exactly happens? Do you get an error?

René Schuster
on 7/9/14, 3:06 AM

Right now: , i get the following error: File "/vagrant/odoo/openerp/sql_db.py", line 230, in execute res = self._obj.execute(query, params) DataError: invalid input syntax for integer: "c" LINE 1: ... ("account_fiscal_attribute"."attribute_use_id" = 'c')) ORDE... ^

David Arnold
on 7/9/14, 11:52 AM
0

Bole

--Bole--
2385
| 5 4 6
Zagreb | Karlovac, Croatia
--Bole--

there is only 10 kind of people the ones that understand binary ... and others

Bole
On 7/9/14, 5:12 AM

try :
<field name="foo_classs_field" domain="[('foo.bar', '=', 'a')]"/>

assuming you have m2m from toplevel to foo class

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

2 follower(s)

Stats

Asked: 7/7/14, 7:22 AM
Seen: 532 times
Last updated: 3/16/15, 8:10 AM