0
votes

i'm trying To Hide Validation button on stock.picking form, I'm searching about the button on stock.view_picking_form and found tow button with name button_validate.

 <button name="button_validate" attrs="{'invisible': ['|', ('state', 'in', ('waiting','confirmed')), ('show_validate', '=', False)]}" string="Validate" type="object" class="oe_highlight" groups="stock.group_stock_user"/>
 <button name="button_validate" attrs="{'invisible': ['|', ('state', 'not in', ('waiting', 'confirmed')), ('show_validate', '=', False)]}" string="Validate" type="object" groups="stock.group_stock_user" class="o_btn_validate"/>

in my condition, I want to hide the first one based on Boolean field using xbath like that

 <xpath expr="//button[@name='button_validate']" position="attributes">
       <attribute name="attrs">{'invisible': ['|','|', ('state', 'in', ('waiting','confirmed')), ('show_validate', '=', False),('is_has_access', '=', 'False')]}</attribute>
 </xpath>

after saving and upgrade the module I found attrs has been updated of button information but it still visible even if the Field = False

So how can I achieve that and hide this button? Any help will be appreciated

1

1 Answers

0
votes

Sometimes a step back (literally) helps ;-)

('show_validate', '=', False),('is_has_access', '=', 'False')

Do you see a difference between those two domain tuples? Focus on the values, yep one has quotations marks one doesn't. One works one doesn't.

So maybe try:

('show_validate', '=', False),('is_has_access', '=', False)

But why is Odoo not throwing an error? That's because a string is a valid boolean value and always represents True.