Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
1 Svar
5841 Visninger

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?

Avatar
Kassér
Bedste svar

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

Avatar
Kassér
Forfatter

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