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

set default checked checkbox when I create new object?

By
Tajjajt
on 4/15/13, 3:22 PM 1,227 views

Holla

I want to set default checked checkbox when I create a new object, I just apply wath's in res.partner module ( customer checkbox and supplier checkbox), My action's code is :

<record id="action_mymodule_form" model="ir.actions.act_window">
            <field name="name">My module</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">my.module</field>
            <field name="view_type">form</field>
            <field name="domain">[('myfield','=',1)]</field>
            <field name="context">{'default_myfield':1, 'search_default_myfield':1}</field>
            <field name="filter" eval="True"/>
        </record>

But it seems not working !

0
Danimar Ribeiro
On 4/15/13, 3:45 PM

I think the best approach is to use _defaults in the class definition.

_defaults = { 'myfield':1 }

in my case, I have two fields myfields1 and myfields2 , I want just like in res.partner, in customer view the customer checkbox is checked, and in supplier view the supplier checkbox is checked.

Tajjajt
on 4/16/13, 7:24 AM

You can use eval to the field I think. <field name="field1" eval="1" />

Danimar Ribeiro
on 4/16/13, 9:20 AM

Help plz it doesn't work at all

Tajjajt
on 4/17/13, 9:47 AM

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

0 follower(s)

Stats

Asked: 4/15/13, 3:22 PM
Seen: 1227 times
Last updated: 3/16/15, 8:10 AM