如何在 Odoo 13 的没有开发人员模式的情况下使员工模块中的时间表可见?
How to make the Schedule visible in Employee module without deverloper mode in Odoo 13?
目前,我只能在开发者模式下看到安排工作时间和时区。
那么,如何在没有开发者模式的情况下让日程表可见呢?
您需要继承表单视图并替换组部分。这会很容易。
类似于:
<record id="view_employee_form" model="ir.ui.view">
<field name="name">hr.employee.form</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name="arch" type="xml">
<xpath expr="//notebook/page/div/div/group[4]" position="replace">
<group string="Schedule">
<field name="resource_calendar_id" required="1"/>
<field name="tz"/>
</group>
</xpath>
</field>
</record>
您正在继承的原始表单视图。扩展简而言之:
<notebook>
<page name="public" string="Work Information">
<div id="o_work_employee_container"> <!-- These two div are used to position org_chart -->
<div id="o_work_employee_main">
<!-- ... -->
<group string="Schedule" groups="base.group_no_one">
<field name="resource_calendar_id" required="1"/>
<field name="tz"/>
</group>
</div>
</div>
</page>
<!-- ... --->
</notebook>
您可以选择删除 groups
属性,该属性与组 base.group_no_one
结合使用,仅用于在调试模式下显示内容:
<record id="view_employee_form" model="ir.ui.view">
<field name="name">hr.employee.form</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='tz']/.." position="attributes">
<attribute name="groups" />
</xpath>
</field>
</record>
目前,我只能在开发者模式下看到安排工作时间和时区。
那么,如何在没有开发者模式的情况下让日程表可见呢?
您需要继承表单视图并替换组部分。这会很容易。
类似于:
<record id="view_employee_form" model="ir.ui.view">
<field name="name">hr.employee.form</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name="arch" type="xml">
<xpath expr="//notebook/page/div/div/group[4]" position="replace">
<group string="Schedule">
<field name="resource_calendar_id" required="1"/>
<field name="tz"/>
</group>
</xpath>
</field>
</record>
您正在继承的原始表单视图。扩展简而言之:
<notebook>
<page name="public" string="Work Information">
<div id="o_work_employee_container"> <!-- These two div are used to position org_chart -->
<div id="o_work_employee_main">
<!-- ... -->
<group string="Schedule" groups="base.group_no_one">
<field name="resource_calendar_id" required="1"/>
<field name="tz"/>
</group>
</div>
</div>
</page>
<!-- ... --->
</notebook>
您可以选择删除 groups
属性,该属性与组 base.group_no_one
结合使用,仅用于在调试模式下显示内容:
<record id="view_employee_form" model="ir.ui.view">
<field name="name">hr.employee.form</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='tz']/.." position="attributes">
<attribute name="groups" />
</xpath>
</field>
</record>