Odoo Help


Return domain on view load

Pichchanok Nuchpan
on 9/19/16, 3:44 AM 1,030 views

Hi i newbie in python and odoo.

Can i return value from python code to action domain in xml or not ?

because i need to use domain like [('create_uid','=',...)] <--- number in array

or convert below this code to python and return them on start load view 

<record id="purchase_rfq_sale" model="ir.actions.act_window">            
<field name="name">Requests for Quotation(Sale)</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">purchase.order</field>
<field name="context">{}</field>
<field name="domain">[]</field>
<field name="view_mode">tree,form,graph,calendar</field>
<field name="search_view_id" ref="purchase.view_purchase_order_filter"/>
<field name="help" type="html">

if you want to filter record by created user id try


yousif Mobark
on 9/21/16, 4:31 AM
On 9/26/16, 7:05 AM

in your python code you can return like this:

return { 'name': 'Partner to Lead',

             'type': 'ir.actions.act_window',

             'view_type': 'form',

             'view_mode': 'tree,form',

             'res_model': 'res.partner',

             'views': [(treeview_id, 'tree')],

             'target': 'current',

             'domain' : domain,


which is the domain variable is the array of your domain.

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 9/19/16, 3:44 AM
Seen: 1030 times
Last updated: 9/26/16, 7:05 AM