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.

1

set default checked checkbox ? [Closed]

By
Tajjajt
on 4/17/13, 10:48 AM 3,269 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??

0

Sudhir Arya (SA)

--Sudhir Arya (SA)--
10150
| 6 8 8
Ahmedabad, India
--Sudhir Arya (SA)--

Working as an OpenERP/Odoo developer and a Team Leader 

Top 5 Odoo contributor On Stackoverflow

LinkedIn

Blog

Stackoverflow

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.

1

Mustufa Rangwala (mra)

--Mustufa Rangwala (mra)--
Tiny ERP Pvt Ltd
http://www.odoo.com
853
| 2 1 4
Ahmedabad, India
--Mustufa Rangwala (mra)--

- Around 7+ years of strong experience in Odoo (Formerly OpenERP) which is world's largest Open Source Business Applications driven by CEO Fabien Pinckaers. - Played key role in developing and maintaining various Odoo Product modules and integrating them on Open Source ERP Environment. - Experience on Scrum methodology for project management - Experience in Team Building - Quick Start Implementations. - Worked on almost all versions (4.0, 5.0, 6.0, 6.1, 7.0, SAAS, Trunk(8.0)...) of Odoo (Formerly OpenERP) . Specialities: Odoo Business Process And OpenERP Implementation. Odoo Application Support and Maintenance. Odoo Technical & Functional Training. Business Process Mapping & Gap Analysis (Functional and Technical Analysis)

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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

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