تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
5592 أدوات العرض

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 !

الصورة الرمزية
إهمال
أفضل إجابة

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.

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

الكاتب

Help plz it doesn't work at all

المنشورات ذات الصلة الردود أدوات العرض النشاط
3
يوليو 23
67710
4
مارس 15
7415
1
مارس 15
6676
0
مارس 15
3795
0
مارس 15
3742