Odoo Help

Welcome!

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

0

Return domain on view load

By
Pichchanok Nuchpan
on 9/19/16, 3:44 AM 201 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>

if you want to filter record by created user id try

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

yousif Mobark
on 9/21/16, 4:31 AM
0
Hengky Zhang
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.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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