Odoo - 覆盖默认公司视图

时间:2017-10-19 12:22:12

标签: openerp odoo-8 odoo-9 odoo-10 odoo-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,我试图覆盖名称字段的默认标签。

修改

__清单__。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'
]
}

1 个答案:

答案 0 :(得分:2)

这里是原点视图的重要部分:

<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>