跳至內容
選單
此問題已被標幟
3 回覆
4363 瀏覽次數

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

頭像
捨棄
最佳答案

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.

頭像
捨棄
作者

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

最佳答案

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


頭像
捨棄
作者

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≥

作者 最佳答案

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≥


頭像
捨棄
作者

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.

相關帖文 回覆 瀏覽次數 活動
1
1月 24
14824
2
3月 18
5546
0
1月 18
3708
2
2月 24
26343
3
2月 25
56613