Skip to Content
Menu
This question has been flagged
3 Replies
3923 Views

Hi,

 

On Vendors form view (res.partner) there are buttons showing:

 "# Quotations"    "# Supplier Bill"    "# Purchases"   etc


 I want those buttons to be visible only to admins

 

My code works fine but I'm getting a WARNING on odoo.log:

WARNING database odoo.addons.base.models.ir_ui_view: A simili button must be in tag a/button/select or tag `input` with type button/submit/reset or have class in btn-group/btn-toolbar/btn-ship


What is causing this simili button warning? Is there a fix for it?

 

My code:

≤record id="edit_edited_res_partner_buttons_named_purchased" model="ir.ui.view"≥
    ≤field name="name"≥edit.partner.buttom.purchased≤/field≥
    ≤field name="model"≥res.partner≤/field≥
    ≤field name="inherit_id" ref="purchase.res_partner_view_purchase_buttons"/≥
    ≤field name="arch" type="xml"≥
        ≤xpath expr="//button[@name='%(purchase.act_res_partner_2_purchase_order)d']" position="attributes"≥
            ≤attribute name="groups"≥__import__.group_menu_admin≤/attribute≥
        ≤/xpath≥
    ≤/field≥
≤/record≥

 

Thanks in advance

Avatar
Discard
Best Answer

Hi Hugo,


EDIT:

The issue raised from your

tag class 'btn-secondary'. If you remove the class or replace it with any class from the ('btn-group', 'btn-toolbar', 'btn-ship'), then it will not raise any error


if you are using any class which is starts with 'btn', then system must check the validations on it. you must follow some rules to define it.


1) It (class) must be in tag  ≤a≥,  ≤button≥,  ≤select≥
2) OR If its in input tag ≤input≥,  then type must be in ('button', 'submit', 'reset')
3) if it will not follow above two , then the tag must have only these classes ('btn-group', 'btn-toolbar', 'btn-ship') in it . Not the 'btn-secondary'.

 
tag class , If you remove the class or replace it with any class from the ('btn-group', 'btn-toolbar', 'btn-ship'), then it will not raise any error.

Hope it will help you.
Please vote the answer.

Avatar
Discard
Author

I did not work...

I've tested your code and the warning persists
I've also tested replacing "groups" attribute with "invisible" attribute and I still get the warning messa

My code:
≤record id="edit_edited_res_partner_buttons_named_purchased" model="ir.ui.view"≥
___≤field name="name"≥edit.partner.buttom.purchased≤/field≥
___≤field name="model"≥res.partner≤/field≥
___≤field name="inherit_id" ref="purchase.res_partner_view_purchase_buttons"/≥
___≤field name="arch" type="xml"≥
______≤xpath expr="//button[@name='%(purchase.act_res_partner_2_purchase_order)d']" position="attributes"≥
_________≤attribute name="invisible"≥1≤/attribute≥
______≤/xpath≥
___≤/field≥
≤/record≥

Hi Hugo
Please check the updated answer

<button class="transparent-button" name="contact_wizard" type="object" string="Business directory" invisible="parent_id or last_satisfaction in [1 , 2 , 3 , 4 , 5]">
<img src="/certification_app/static/src/img/Satisfaction client défaut.png" style="width:80px"/>
</button>

please help me im encountered the same error too, above is an example code of one of my error
i have tried add the btn-group in class but still the same i also try add alt but the result is still the same

Best Answer

I thinks it's raise due to attribute that you have added give the external_xml id in groups attribute


Avatar
Discard
Author

It did not work...

I tested by replacing "groups" attribute with "invisible" attribute and I still get the warning messa

My code:
≤record id="edit_edited_res_partner_buttons_named_purchased" model="ir.ui.view"≥
___≤field name="name"≥edit.partner.buttom.purchased≤/field≥
___≤field name="model"≥res.partner≤/field≥
___≤field name="inherit_id" ref="purchase.res_partner_view_purchase_buttons"/≥
___≤field name="arch" type="xml"≥
______≤xpath expr="//button[@name='%(purchase.act_res_partner_2_purchase_order)d']" position="attributes"≥
_________≤attribute name="invisible"≥1≤/attribute≥
______≤/xpath≥
___≤/field≥
≤/record≥

Author Best Answer

EDIT: I may have found the source of the problem, but I still don't know how to solve it

It seems that the error started when I created a particular button inside res.partner's kanban:

- If I remove this button's code ALL of the "simili button" warning disapear


The code:

≤record id="edit_res_partner_form" model="ir.ui.view"
≤field
name="name"edit.partner.form≤/field≥
≤field
name="model"res.partner≤/field≥
≤field
name="inherit_id" ref="base.view_partner_form" /≥
≤field
name="arch" type="xml"
    ≤xpath
expr="//t[@t-name='kanban-box']" position="replace"
        ≤t
t-name="kanban-box"
            ≤div
t-att-class="color + (record.title.raw_value == 1 ? ' oe_kanban_color_alert' : '') + ' oe_kanban_global_click'"
                ≤div
class="o_kanban_image"
                    ≤a
role="button" type="object" class="btn-group" string="Called"
                        ≤div
class="btn-secondary"
                            ≤span≥Cliente called
≤/span≥
                        ≤/div≥
                    ≤/a≥
                ≤/div≥
            ≤/div≥
        ≤/t≥
    ≤/xpath≥
≤/field≥
≤/record≥


Avatar
Discard
Author

Found the problem!

It seems that using ≤div class="btn-secondary"≥ caused the "simili button warning" not only for the button itself, but for every button created by that particular module. Must be a rare minor bug.

My fixed code:

≤a role="button" type="object" class="btn-group btn-secondary" string="Liguei"≥
Liguei
≤/a≥

Hi Hugo,

The issue raised from your <div> tag class 'btn-secondary'. If you remove the class or replace it with any class from the ('btn-group', 'btn-toolbar', 'btn-ship'), then it will not raise any error

if you are using any class which is starts with 'btn', then system must check the validations on it. you must follow some rules to define it.

1) It (class) must be in tag <a>, <button>, <select>
2) OR If its in input tag <input>, then type must be in ('button', 'submit', 'reset')
3) if it will not follow above two , then the tag must have only these classes ('btn-group', 'btn-toolbar', 'btn-ship') in it . Not the 'btn-secondary'.

The issue raised from your <div> tag class , If you remove the class or replace it with any class from the ('btn-group', 'btn-toolbar', 'btn-ship'), then it will not raise any error.

Hope it will help you.
Please vote the answer.

Related Posts Replies Views Activity
1
Jan 24
14170
2
Mar 18
5020
0
Jan 18
3121
2
Feb 24
25549
3
Feb 25
55417