微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在 Odoo 13 中继承和修改日历视图?

如何解决如何在 Odoo 13 中继承和修改日历视图?

我想在我的自定义模块中继承日历视图并编辑它的 date_stop 属性,我该如何继承并做到这一点?一段代码会有很大帮助!这里有一些细节。 (我是 odoo 的新手)

模块:休息时间

型号:hr.leave

外部 ID(日历视图):hr_holidays.hr_leave_view_dashboard

我试过了,但显示错误

<!--Adding stop date 2 to calendar-->
    <record id="view_order_tree_inherited" model="ir.ui.view">
        <field name="name">calendar2.inherited</field>
        <field name="model">hr.leave</field>
        <field name="inherit_id" ref="hr_holidays.hr_leave_view_dashboard"/>
        <field name="arch" type="xml">
            <calendar js_class="time_off_calendar" string="Time Off Request" form_view_id="%(hr_holidays.hr_leave_view_form_dashboard)d" event_open_popup="true" date_start="date_from" date_stop="date_to_2" mode="month" quick_add="False" color="employee_id">
                <field name="display_name"/>
            </calendar>
        </field>
    </record>

解决方法

您应该在日志中看到以下错误:

Element '<calendar ...>' cannot be located in parent view

要更改日历 date_stop 属性,您需要使用位置 attributes。尝试将 calendar 标记替换为以下内容:

<calendar position="attributes">
    <attribute name="date_stop">date_to_2</attribute>
</calendar>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。