【问题标题】:Odoo - Override default company viewOdoo - 覆盖默认公司视图
【发布时间】:2017-10-19 12:22:11
【问题描述】:

我正在使用 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'
]
}

【问题讨论】:

  • 您是否在__manifest__.py 中提供了此文件的路径?
  • 是的,只是忘了提问题
  • hmm,尝试设置主要模式,即在arch之前添加&lt;field name="mode"&gt;primary&lt;/field&gt;
  • 累了,但这并没有什么区别!!!!
  • 为什么要更改字段名字符串属性?

标签: openerp odoo-8 odoo-9 odoo-10 odoo-view


【解决方案1】:

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

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

【讨论】:

  • 好的,这行得通。通过使用相同的方法,我们还可以更改显示在树视图中创建按钮上方的菜单名称及其标题吗?
  • 这也应该可以。型号为ir.ui.menu,您要查找的外部ID 为base.menu_action_res_company_form
  • 谢谢你的帮助!
猜你喜欢
  • 2020-05-04
  • 1970-01-01
  • 2012-04-10
  • 1970-01-01
  • 2012-03-15
  • 2022-06-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多