콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
5846 화면

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