首页 > 解决方案 > 在 LeaveForm 的 TimeOff 模块中添加休假类型的组合?Odoo13

问题描述

我需要在 TimeOff 模块表单中添加一个可以组合两种休假类型的功能,并且当用户提交表单时,休假会从相应的休假类型中扣除。(在表格中,我正在考虑添加第二个下拉菜单,他/她可以在其中添加其他时间)。

我正在使用 Odoo13,我正在继承模块,但无法弄清楚添加一个下拉列表,用户可以在其中选择多个叶子。

模型=hr.leave,externalid = hr_holidays.hr_leave_view_form

我做过的工作:

我在 Odoo13 中创建了一个继承 hr_holidays 模块的模块,在请假表单中,我成功添加了上面的下拉菜单,但它选择了上面选择的相同休假类型。

这是xml文件:

<?xml version='1.0' encoding='UTF-8' ?>
<odoo>
    <!--Adding the Drop Down-->

    <record id="hr_leave_view_form_addnewleave" model="ir.ui.view">
        <field name="name">leave.addleave</field>
        <field name="model">hr.leave</field>
        <field name="inherit_id" ref="hr_holidays.hr_leave_view_form"/>
        <field name="arch" type="xml">
            <xpath expr="//div[@name='description']" position="before">
                <div class="row" name="status_id">
                    <label class="col-2 mr-0" for="holiday_status_id"/>
                    <!-- RLI FIXME: we should avoid redefining the domain in the view when there already is a domain on the model -->
                    <field name="holiday_status_id" domain="['&amp;', ('virtual_remaining_leaves', '&gt;', 0), '|', ('allocation_type', 'in', ['fixed_allocation', 'no']),'&amp;',('allocation_type', '=', 'fixed'), ('max_leaves', '>', '0')]" context="{'employee_id':employee_id, 'default_date_from':date_from}" options="{'no_create': True, 'no_open': True}" class="col-9 pl-0" nolabel="1"/>
                </div>
            </xpath>
        </field>
    </record>


</odoo>

在此代码用于下拉菜单。

带有 dropdowm 的 LeaveForm 图像

提前致谢。请查看我上传的照片。

标签: odooodoo-12developer-tools

解决方案


推荐阅读