Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
3 Răspunsuri
14736 Vizualizări

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>


Imagine profil
Abandonează
Cel mai bun răspuns

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.

Imagine profil
Abandonează
Autor

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

Cel mai bun răspuns

Hello Anthony MIEGGE, 

Please find Code in comment.

I Hope this will help you. 

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

Imagine profil
Abandonează

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"/>

Autor

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

Cel mai bun răspuns

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


Imagine profil
Abandonează
Autor

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.

Related Posts Răspunsuri Vizualizări Activitate
0
dec. 23
1523
2
nov. 22
4236
4
mai 22
4555
1
mar. 22
2716
1
dec. 20
2604