2017-10-19 122 views
2

我正在使用odoo 10e。我想改變公司的形式和樹形視圖。於是我就按照本教程 HelpOdoo - 覆蓋默認公司視圖

,這就是我試過,但它不工作

<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' 
] 
} 
+0

你有沒有在你的'__manifest提供的此文件路徑__ py'? – tidylobster

+0

是的,我只是忘記提及 – Ancient

+0

嗯,試着設置主模式,即在'arch' – tidylobster

回答

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

好的,這個工程。通過使用相同的方法,我們也可以更改菜單名稱和它的標題,它顯示在樹形視圖中的創建按鈕上方嗎? – Ancient

+1

這也應該起作用。該模型是'ir.ui.menu',您要查找的外部標識是'base.menu_action_res_company_form'。 – CZoellner

+0

謝謝男士感謝您的幫助! – Ancient