İçereği Atla
Menü
Bu soru işaretlendi
3 Cevaplar
14994 Görünümler

I just installed the hr_holidays module. In the list view of the dashboard, everyone can see the buttons "Approve/validate" and "Refuse". In the code, it is specifically told that you need a hr_holidays group to see them. This part doesn't work, and I can't get to bring that back again.

< button string="Approuver" name="action_approve" type="object" icon="fa-thumbs-up" states="confirm" invisible="1" modifiers="{'invisible':[['state','not in',['confirm']]],'column_invisible':true}" options="{}"/>
< button string="Valider" name="action_validate" type="object" icon="fa-check" states="validate1" invisible="1" modifiers="{'invisible':[['state','not in',['validate1']]],'column_invisible':true}" options="{}"/>
< button string="Refuser" name="action_refuse" type="object" icon="fa-times" states="confirm,validate1" invisible="1" modifiers="{'invisible':[['state','not in',['confirm','validate1']]],'column_invisible':true}" options="{}"/>

Here are the buttons rendered in fields view get. They all have "invisible='1'", but they all are visible.

Code-side, we have a groups attribute bound to the buttons, which trigger the "invisible" appearance, but doesn't change much.


Edit : Neither of these code change anything to the problem :

< record id="hr_holidays_view_tree_user" model="ir.ui.view">
< field
name="name">hr.holidays.view.tree.user< /field>
< field
name="model">hr.leave< /field>
< field
name="inherit_id" ref="hr_holidays.hr_leave_view_tree" />
< field
name="groups_id" eval="[(5, 0, [ref('hr_holidays.group_hr_holidays_manager'), ref('hr_holidays.group_hr_holidays_user')])]" />
< field
name="arch" type="xml">
< xpath
expr="//button[@name='action_approve']" position="attributes">
< attribute
name="modifiers">{'invisible': 1}< /attribute>
< /xpath>
< /field>
< /record>
< record id="hr_holidays_view_tree_user" model="ir.ui.view">
< field
name="name">hr.holidays.view.tree.user< /field>
< field
name="model">hr.leave< /field>
< field
name="inherit_id" ref="hr_holidays.hr_leave_view_tree" />
< field
name="groups_id" eval="[(5, 0, [ref('hr_holidays.group_hr_holidays_manager'), ref('hr_holidays.group_hr_holidays_user')])]" />
< field
name="arch" type="xml">
< xpath
expr="//button[@name='action_approve']" position="attributes">
< attribute
name="invisible">1< /attribute>
< /xpath>
< /field>
< /record>
< record id="hr_holidays_view_tree_user" model="ir.ui.view">
< field
name="name">hr.holidays.view.tree.user< /field>
< field
name="model">hr.leave< /field>
< field
name="inherit_id" ref="hr_holidays.hr_leave_view_tree" />
< field
name="groups_id" eval="[(5, 0, [ref('hr_holidays.group_hr_holidays_manager'), ref('hr_holidays.group_hr_holidays_user')])]" />
< field
name="arch" type="xml">
< xpath
expr="//button[@name='action_approve']" position="attributes">
< attribute name="groups">hr_holidays.group_hr_holidays_user,hr_holidays.group_hr_holidays_manager< /attribute>
< /xpath>
< /field>
< /record>


Avatar
Vazgeç
En İyi Yanıt

Based on the code snippet you shared, you have defined the invisible attribute multiple times like in the second line your code snippet:  invisible=1, modifiers="{'invisible... , 'column_invisible':true....

Try invisible=1 only for each button.

Avatar
Vazgeç
Üretici

Thanks for your answer.
Unfortunately, this doesn't solve my problem, check my edit

En İyi Yanıt

Hello Anthony MIEGGE, 

Please find Code in comment.

I Hope this will help you. 

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari 

Avatar
Vazgeç

You can add group in button for example.

.XML Data file
<record id="group_1" model="res.groups">
<field name="name">Button Hide</field>
<field name="category_id" ref="base.module_category_hidden"/>
</record>

<button name="my_button" string="My Button" type="object" groups="module_name.group_1"/>

Üretici

Thanks for your answer.
Unfortunately, this doesn't solve my problem, check my edit

En İyi Yanıt

Hi Anthony MIEGGE,


To Make the button 'invisible' try ,


<button string="Validate" name="action_validate" states="validate1" type="object" invisible="1" class="oe_highlight"/>


or to make the field 'invisible' based on the values of other fields try,


<button string="Validate" name="action_validate" states="validate1" type="object" attrs="{'invisible':[('state', 'not in', ('validate'))]}" class="oe_highlight"/>


Hope it helps,
Kiran K


Avatar
Vazgeç
Üretici

I'll state again what I might have said the wrong way.
My problem is that, even with "invisible='1'" or with "groups=base.blahblahblah", my buttons stay visible.
That's why your answer doesn't work.

İlgili Gönderiler Cevaplar Görünümler Aktivite
0
Ara 23
1775
2
Kas 22
4482
4
May 22
4821
1
Mar 22
2982
1
Ara 20
2756