从XML调用JS函数

问题描述 投票:0回答:1
javascript odoo owl-carousel odoo-17
1个回答
1
投票

选择器需要是事件元素的父级,因此您应该更新它。

包围事件元素的

<div class="mb4">
现在添加了一个名为
wrap-div
的新类。

<template id="portal_my_attendances_inherit" name="My Attendances" inherit_id="hr_attendance_portal.portal_my_attendances">
    <xpath expr="//t[@t-call='portal.portal_searchbar']" position="after">
        <div class="mb4 wrap-div">
            <t t-if="env.user.employee_id">
                <a t-if="env.user.employee_id.attendance_state != 'checked_in'" href="#" class="btn btn-success checkInBtn">Check Inn <i class="fa fa-sign-in"/></a>
                <t t-else="">
                    <a href="#" class="btn btn-warning checkOutBtn">Check Out <i class="fa fa-sign-out"/></a>
                    <strong> Hours today:</strong>
                    <span t-field="env.user.employee_ids.hours_today" t-options="{'widget': 'float_time'}" />
                    <small>(refresh page to update)</small>
                </t>
            </t>
        </div>
    </xpath>
</template>

那么,

selector: '.wrap-div',
© www.soinside.com 2019 - 2024. All rights reserved.