跳至內容
選單
此問題已被標幟
2 回覆
7515 瀏覽次數

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>
頭像
捨棄

if you want to filter record by created user id try

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

最佳答案

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.

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
2
12月 22
15458
1
11月 21
5527
0
1月 21
2798
8
5月 20
8476
0
12月 23
3384