This question has been flagged
2 Replies
6413 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">
</field>
</record>
Avatar
Discard

if you want to filter record by created user id try

[('create_uid','=',uid)]

Best Answer

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.

Avatar
Discard