Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
6516 Weergaven

Hello !

I have a form, and when i have checked my checkbok i would like odoo don't show this form. 

How can i do ? 

What is the codee to use ? 

Thanks ! 

Avatar
Annuleer
Beste antwoord

you can use the attrs in XML in order to make fields, group, notebook, page invisible, read-only & required. Here is a piece of code that might help you.

  <field name="checkbox_field" string='Make Group Invisible?'  />
  <group name="my group" attrs="{'invisible' : [('checkbox_field', '=', True)]}">
<field name='field1'/>
<field name='field2'/>
</group>

when you check the check box it will make the whole group invisible.

Avatar
Annuleer
Beste antwoord

Hello Coco,


For don't show a form when click, you need to add attrs to the form view.


For Ex:-

<record id="unique_id" model="ir.ui.view">

    <field name="name">name</field>

    <field name="model">model_name</field>

    <field name="arch" type="xml">

        <form>

              <group name="field_group" attrs="{'invisible' : [('your_checkbox_name', '=', True)]}">

                    <field name="field1"/>

                     <field name="field2"/>

              </group>

         </form>

     </field>

</record>


Hope, it will help you.

Thanks,

Avatar
Annuleer
Auteur

Hello, I have an error :( Uncaught Error: Unknown field check_box_form in domain [["check_box_form","=",true]] http://10.56.8.44:8069/web/static/src/js/framework/data.js:1075 Traceback: Error: Unknown field check_box_form in domain [["check_box_form","=",true]] at Object.compute_domain (http://10.56.8.44:8069/web/static/src/js/framework/data.js:1075:19) at OdooClass.View.extend.compute_domain (http://10.56.8.44:8069/web/static/src/js/views/form_view.js:1151:21) at OdooClass. (http://10.56.8.44:8069/web/static/src/js/views/form_common.js:316:40) at OdooClass.Class.extend.trigger (http://10.56.8.44:8069/web/static/src/js/framework/mixins.js:222:31) at OdooClass._.extend.trigger (http://10.56.8.44:8069/web/static/src/js/framework/mixins.js:272:42) at OdooClass.View.extend.on_form_changed (http://10.56.8.44:8069/web/static/src/js/views/form_view.js:396:14) at Array. (http://10.56.8.44:8069/web/static/src/js/views/form_view.js:365:18) at Array. (http://10.56.8.44:8069/web/static/lib/jquery/jquery.js:3276:89) at fire (http://10.56.8.44:8069/web/static/lib/jquery/jquery.js:3119:58) at Object.self.add [as done] (http://10.56.8.44:8069/web/static/lib/jquery/jquery.js:3165:49)

have you add your field in form view as say by Atul Arvind sir ?

Auteur

Yes i had add the attributes in the form. But the problem is : when i click on my module i have my form like a pop up. In the configuration of the module you add this check box. The check box isn't in the form. Do you see what i mean ?

Form can't be hide through attrs. You can invisible, readonly and required to notebook, page, fields, groups.

Auteur

ok but if the form is like that :

if i put the attributes in the groupes the footer is visible
Auteur

form - group - footer - /form *

May be, you can also add attrs in the footer to invisible it.

Auteur

I have the same error :(

can you post your code with the error msg ?

check_box_form field should be in your form view.

Gerelateerde posts Antwoorden Weergaven Activiteit
2
mei 24
1644
2
dec. 23
1291
1
nov. 22
2654
0
jan. 21
2227
5
jul. 19
4720