Files
gzth/yuthon_hr_employee/views/res_company_views.xml
T
2026-09-02 11:20:34 +08:00

60 lines
2.7 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!--
分公司表单视图(自包含,不继承 base.view_company_form)
原因:线上 base.view_company_form 外部标识被污染指向了 account.journal.form,
任何继承它的视图都会报 ParseError。这里从根写一个独立表单,
由 many2many_tags_preview 的 open_form_view 上下文按需打开,彻底绕开污染。
-->
<record id="yuthon_hr_employee_res_company_form" model="ir.ui.view">
<field name="name">yuthon.hr.employee.res.company.form</field>
<field name="model">res.company</field>
<field name="priority">50</field>
<field name="arch" type="xml">
<form string="分公司">
<sheet>
<div class="oe_title">
<h1>
<field name="name" readonly="0" placeholder="分公司名称"/>
</h1>
</div>
<group>
<group>
<field name="parent_id"/>
<field name="child_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
</group>
<group>
<field name="email"/>
<field name="phone"/>
<field name="website"/>
</group>
</group>
<group>
<field name="street"/>
<field name="street2"/>
<field name="zip"/>
<field name="city"/>
<field name="country_id"/>
</group>
</sheet>
</form>
</field>
</record>
<!--
在公司列表的“分公司”标签列(child_ids, widget=many2many_tags) 注入 open_form_view,
点击标签时 many2many_tags_preview 会按 xmlid 打开上面自包含的表单(可编辑)。
精确匹配 widget='many2many_tags' 的那个,避免影响层级区里另一个 child_ids。
-->
<record id="yuthon_hr_employee_view_company_tree_ctx" model="ir.ui.view">
<field name="name">yuthon.hr.employee.res.company.tree.ctx</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='child_ids' and @widget='many2many_tags']" position="attributes">
<attribute name="context">{'open_form_view': 'yuthon_hr_employee.res.company.form'}</attribute>
</xpath>
</field>
</record>
</odoo>