Odoo Help

1

set default checked checkbox ? [Closed]

By
Tajjajt
on 4/17/13, 10:48 AM 4,449 views

The Question has been closed

by
Sudhir Arya (SA)
on 04/18/2013 05:21:35

Hellow

I have two fields myfields1 and myfields2 (boolean), I want just like in res.partner, in customer view the customer checkbox is checked, and in supplier view the supplier checkbox is checked. I want in a view1 set myfields1 checkbox checked and in view2 set myfields2 checkbox checked.

How can'I do that??

1
Sudhir Arya (SA)
On 4/17/13, 11:20 AM

You can do it by passing {'default_youfield':value} in context of action.

Here is an example in which I want only Supplier and not Customer:

<record model="ir.actions.act_window" id="action_partner_my">
    <field name="name">My Supplier Partner</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">res.partner</field>
    <field name="view_type">form</field>
    <field name="view_mode">tree,form</field>
    <field name="context">{"search_default_supplier":1,"default_supplier":1,"default_customer":0}</field>
</record>

When I will click on this action Supplier field will be True and Customer field will be False.

2
Mustufa Rangwala (mra)
On 4/17/13, 11:19 AM

You can check context passed for suppliers => <field name="context">{'search_default_supplier': 1,'default_customer': 0,'default_supplier': 1}</field>

You have to pass your values in action.

Code:

<record id="action_partner_supplier_form" model="ir.actions.act_window">
            <field name="name">Suppliers</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">res.partner</field>
            <field name="view_type">form</field>
            <field name="domain">[]</field>
            <field name="view_mode">kanban,tree,form</field>
            <field name="context">{'search_default_supplier': 1,'default_customer': 0,'default_supplier': 1}</field>
            <field name="filter" eval="True"/>

Regards, Mustufa

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.

Register

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

2 follower(s)

Stats

Asked: 4/17/13, 10:48 AM
Seen: 4449 times
Last updated: 3/16/15, 8:10 AM