Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
5843 Lượt xem

Hello, I tried to expand base.xml template. Example is:

<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space='preserve'>
    <t t-extend="FormView.buttons">
        <t t-if="widget.fields_view.state !== 'done'">
        <div class="o_form_buttons_view">
            <button t-if="widget.is_action_enabled('create')"
                    type="button" class="oe_form_button_create btn btn-default btn-sm"
                    accesskey="C">
                Create
            </button>
        </div>
        </t>
    </t>
</templates>


To manifest (__openerp__.py) added "base" to dependences and:ded base to dependencies:

'qweb' : [
        "static/src/xml/base.xml",
    ],


But nothing happens, what's wrong?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

after t-extend you should use t-jquery

eg:

<t t-jquery="button.some_class" t-operation="replace">

//  your code

</t>


You can also hide these buttons using csv files and assigning users specific groups

Ảnh đại diện
Huỷ bỏ
Tác giả

Thank you. It helps. Now I see the button. But the problem is that I want hide these buttons depend on module state. Not only on user group role. For example if state is draft user with user group role can see "Edit" and "Create" buttons. I see this state: <t t-if="widget.fields_view.state !== 'done'"> don't work so for a while I don't have any decisions..