Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
3355 Переглядів

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 

Аватар
Відмінити

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>

Автор

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

Найкраща відповідь

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

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
0
квіт. 22
2086
1
квіт. 17
2802
1
лют. 23
7933
2
трав. 22
2788
1
трав. 22
3461