Community: Framework mailing list archives

Domain filters - comparing model fields - is it really working?

Maxim Litnitskiy
- 09/04/2014 04:31:38
I am reading "Understanding Odoo domain filters" -
>From there:

domain = ['|', ('field1','=',field3),('field1','=',field3)]

I have a model:

   _columns = {
        'src': fields.char(size=80, string='Src', select=1),
        'src_user_exten': fields.char(string='Src user exten'),

Now I have the following filter:

<field name='domain'>[('src', '=', src_user_exten)]</field>

It does not work - Uncaught Error: NameError: name 'src_user_exten' is not defined

When I use quotes like that: <field name='domain'>[('src', '=', 'src_user_exten')]</field>

The following goes to PostgreSQL (from PG log collector):

SELECT "astpbx_cdr".id FROM "astpbx_cdr" WHERE (("astpbx_cdr"."src" = 'src_user_exten') 

The string goes into query not value.

How can we  use smth like that: domain = ['|', ('field1','=',field3),('field1','=',field3)] ????