Community: Framework mailing list archives

expert-framework@mail.odoo.com

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

by
Maxim Litnitskiy
- 09/04/2014 07:33:38
Thank You Hans for your advice.
But this is actually an action domain not view domain.
Here is the full code:

        <record id='astpbx_user_cdr_dialed_action' model='ir.actions.act_window'>
            <field name='name'>User Dialed CDR</field>
            <field name='res_model'>astpbx.cdr</field>
            <field name='view_type'>form</field>
            <field name='view_mode'>tree</field>
            <field name='view_id' ref='astpbx_user_cdr_list'/>
            <field name='domain'>
                [
                    ('src', '=', src_user_exten),
                    '|',
                    ('src_user_id','=', uid),
                    ('dst_user_id','=', uid),
                ]
            </field>
        </record>

        <record id='astpbx_user_cdr_list' model='ir.ui.view'>
            <field name='name'>astpbx.user.cdr.list</field>
            <field name='model'>astpbx.cdr</field>
            <field name='type'>tree</field>
            <field name='arch' type='xml'>
                <tree string='Call detail records'>
                    <field name='calldate'/>  
                    <field name='clid'/>                        
                    <field name='src'/>  
                    <field name='dst'/>                                    
                    <field name='billsec'/>
                    <field name='src_user_exten'/>
                    <field name='dst_user_exten'/>
                </tree>
            </field>
        </record>       

I just want to force a filter on list view to show records where src = src_user_exten.

Thank you.


2014-09-04 12:50 GMT+04:00 Hans Yonathan <hans.yonathan@falinwa.com>:

You must define src_user_exten field, in the view too.

 

Thank You.

 

Best Regards,

Hans Yonathan

OpenERP Support

FALINWA Limited

Expert in Finance & Business Intelligence

OpenERP Partner

Website: www.falinwa.com

 

From: Maxim Litnitskiy [mailto:litnimaxster@gmail.com]
Sent: Thursday, September 04, 2014 4:38 PM
To: Community: Framework
Subject: Domain filters - comparing model fields - is it really working?

 

I am reading "Understanding Odoo domain filters" - http://toolkt.com/site/understanding-odooopenerp-domain-filter/

>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)] ????

 

Thanks.

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-framework-62
Post to: mailto:expert-framework@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-framework-62
Post to: mailto:expert-framework@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe