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

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

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
أبريل 22
2068
1
أبريل 17
2785
1
فبراير 23
7916
2
مايو 22
2779
1
مايو 22
3453