Odoo - 覆盖默认公司视图
Odoo - Override default company view
我正在使用 odoo 10e。我想改变公司形式和树视图。所以我正在关注本教程
Help
这是我尝试过的方法,但它不起作用
<odoo>
<data>
<record model="ir.ui.view" id="view_crm_lead_form_inherited">
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form" />
<field name="arch" type="xml">
<field name="name" position="attributes">
<attribute name="string">Custodian Name</attribute>
</field>
</field>
</record>
</data>
</odoo>
我看到公司模型有一个字段 name
,我正在尝试覆盖名称字段的默认标签。
编辑
__manifest__.py
# -*- coding: utf-8 -*-
{
'name': "Test",
'summary': """
Short (1 phrase/line) summary of the module's purpose, used as
subtitle on modules listing or apps.openerp.com""",
'description': """
Long description of module's purpose
""",
'author': "Ancient",
'website': "http://www.google.com",
# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/master/odoo/addons/base/module/module_data.xml
# for the full list
'category': 'Accounting',
'version': '0.1',
# any module necessary for this one to work correctly
'depends': ['base', 'mail'],
# always loaded
'data': [
'security/ir.model.access.csv',
'security/amgl_security.xml',
'views/views.xml',
'views/customer.xml',
'views/dashboard.xml',
'views/products.xml',
'views/order.xml',
'views/order_line.xml',
'views/metal_movement.xml',
'views/possible_solutions.xml',
'views/possible_reasons.xml',
'views/pending_accounts.xml',
'views/dealer.xml',
'emailTemplates/mmr_create_mail.xml',
'emailTemplates/reject_mmr_email.xml',
'emailTemplates/mmr_approval_complete.xml',
'emailTemplates/mmr_approve_reject_button.xml',
'report/metal_movement_template.xml',
'report/metal_movement_view.xml',
'views/res_company.xml'
],
'qweb': [
"views/colspan.xml",
],
# only loaded in demonstration mode
'demo': [
'demo/demo.xml',
'demo/customer_view.xml'
]
}
这里是原始视图的重要部分:
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name" class="oe_inline"/>
</h1>
<label for="rml_header1" class="oe_edit_only"/>
<h3>
<field name="rml_header1" placeholder="e.g. Global Business Solutions"/>
</h3>
</div>
您必须更改标签,因为您尝试覆盖的字段标签从未使用过。
以下应该有效:
<label for="name" position="attributes">
<attribute name="string">Custodian Name</attribute>
<attribute name="for" />
</label>
我正在使用 odoo 10e。我想改变公司形式和树视图。所以我正在关注本教程 Help
这是我尝试过的方法,但它不起作用
<odoo>
<data>
<record model="ir.ui.view" id="view_crm_lead_form_inherited">
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form" />
<field name="arch" type="xml">
<field name="name" position="attributes">
<attribute name="string">Custodian Name</attribute>
</field>
</field>
</record>
</data>
</odoo>
我看到公司模型有一个字段 name
,我正在尝试覆盖名称字段的默认标签。
编辑
__manifest__.py
# -*- coding: utf-8 -*-
{
'name': "Test",
'summary': """
Short (1 phrase/line) summary of the module's purpose, used as
subtitle on modules listing or apps.openerp.com""",
'description': """
Long description of module's purpose
""",
'author': "Ancient",
'website': "http://www.google.com",
# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/master/odoo/addons/base/module/module_data.xml
# for the full list
'category': 'Accounting',
'version': '0.1',
# any module necessary for this one to work correctly
'depends': ['base', 'mail'],
# always loaded
'data': [
'security/ir.model.access.csv',
'security/amgl_security.xml',
'views/views.xml',
'views/customer.xml',
'views/dashboard.xml',
'views/products.xml',
'views/order.xml',
'views/order_line.xml',
'views/metal_movement.xml',
'views/possible_solutions.xml',
'views/possible_reasons.xml',
'views/pending_accounts.xml',
'views/dealer.xml',
'emailTemplates/mmr_create_mail.xml',
'emailTemplates/reject_mmr_email.xml',
'emailTemplates/mmr_approval_complete.xml',
'emailTemplates/mmr_approve_reject_button.xml',
'report/metal_movement_template.xml',
'report/metal_movement_view.xml',
'views/res_company.xml'
],
'qweb': [
"views/colspan.xml",
],
# only loaded in demonstration mode
'demo': [
'demo/demo.xml',
'demo/customer_view.xml'
]
}
这里是原始视图的重要部分:
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name" class="oe_inline"/>
</h1>
<label for="rml_header1" class="oe_edit_only"/>
<h3>
<field name="rml_header1" placeholder="e.g. Global Business Solutions"/>
</h3>
</div>
您必须更改标签,因为您尝试覆盖的字段标签从未使用过。
以下应该有效:
<label for="name" position="attributes">
<attribute name="string">Custodian Name</attribute>
<attribute name="for" />
</label>