Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
5576 Visualizzazioni

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 !

Avatar
Abbandona
Risposta migliore

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

_defaults = { 'myfield':1 }

Avatar
Abbandona
Autore

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.

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

Autore

Help plz it doesn't work at all

Post correlati Risposte Visualizzazioni Attività
3
lug 23
67677
4
mar 15
7388
1
mar 15
6632
0
mar 15
3784
0
mar 15
3723