Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
5840 มุมมอง

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?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
ผู้เขียน

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..