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

How to get value when context tag is used

By
shameem
on 2/17/15, 2:15 AM 1,876 views

How to pass value from xml file to .py file by using context tag. please explain with an example

3

Vasanth

--Vasanth--
3458
| 5 3 8
Pondicherry, India
--Vasanth--
Vasanth
On 2/17/15, 2:58 AM

hi shameem,

you can pass the context values by the xml by following ways:

 

1.        For the window action,

<record id="product_normal_action_tree" model="ir.actions.act_window">
            <field name="name">Products</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">product.product</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,kanban</field>
            <field name="context">{'categ_id':active_id, 'search_default_categ_id':active_id}</field>
        </record>

2. foe a particular field

<field name="name" context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}"/>

3. for a filter.

<filter string="Pending Tasks" domain="[('state','=','pending')]" context="{'show_delegated':False}"/>

1

Ankit H Gandhi(AHG)

--Ankit H Gandhi(AHG)--
996
| 5 3 6
Rajkot, India
--Ankit H Gandhi(AHG)--

Learning Python..

Ankit H Gandhi(AHG)
On 2/17/15, 3:48 AM

Hello shameem,

follow this link hope may be help full

https://www.odoo.com/forum/help-1/question/what-is-context-58824

if you find this answer helpful, please give me a thumbs up vote    

Thanks & Regards,

Ankit H Gandhi

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: 2/17/15, 2:15 AM
Seen: 1876 times
Last updated: 3/16/15, 8:10 AM