Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
3356 Prikazi

Hello,

I've created my own module and I want to add attributes to a tree present in my view.

I've create this inherit views but I've got a problem with the addition of attributes for my tree.


This my code for change my parent form view:

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

<field name="name">hide.create.register.tree</field>

<field name="model">training.actions</field>

<field name="inherit_id" ref="x_training.training_actions_form"/>

<field name="type">form</field>

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

<xpath expr="//field[@name='registred']/tree" position="attributes">

<attribute name="create">False</attribute>

</xpath>

<xpath expr="//field[@name='blocking_registrations']" position="after">

<field name="max_trained"/>

</xpath>

</field>

</record>



When I go to my module and I click on the button "Create" nothing appends.

If I remove this part of my code :

<xpath expr="//field[@name='registred']/tree" position="attributes">

<attribute name="create">False</attribute>

</xpath>



I can open the parent form by clicking on button "Create".

What's wrong ?

Thanks for your help.

Regards 

Avatar
Opusti

TIP for pasting code... please put it first through this tool:
https://www.online-toolz.com/tools/text-html-entities-convertor.php
I will convert all brackets, slashes to enities ... then paste it again.. I know this editor is helly buggy

IS THIS YOUR CODE?
<pre>
<field name="name">hide.create.register.tree</field>
<field name="model">training.actions</field>
<field name="inherit_id" ref="x_training.training_actions_form"/>
<field name="type">form</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='registred']/tree" position="attributes">
<attribute name="create">False</attribute>
</xpath>
<xpath expr="//field[@name='blocking_registrations']" position="after">
<field name="max_trained"/>
</xpath>
</field>
</pre>

Avtor

Thanks Krys.Raj
This my code.
I update my post

Best Answer

Hi,

<record id="hide_create_registred_tree" model="ir.ui.view">
<field name="name">hide.create.register.tree</field>
<field name="model">training.actions</field>
<field name="inherit_id" ref="x_training.training_actions_form"/>
    <field name="type">form</field>
    <field name="arch" type="xml">
<xpath expr="//field[@name='registred']/tree" position="attributes">
            <attribute name="create">0</attribute>
        </xpath>
<xpath expr="//field[@name='blocking_registrations']" position="after">
            <field name="max_trained"/>
        </xpath>
    </field>
</record>
Also, make sure that the ref="x_training.training_actions_form" reference is correct


Hope it helps

Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
0
apr. 22
2086
1
apr. 17
2803
1
feb. 23
7934
2
maj 22
2788
1
maj 22
3462