继承Sales Dashboard以添加一些功能(Odoo 10)

时间:2017-10-25 14:18:58

标签: xml openerp

您好我正在尝试继承Sales Dashboard视图,以便添加将链接到我的One2many记录的内容。我试图继承视图但得到错误。

 <record model="ir.ui.view" id="sales_targets_kanban_inherit_id" >
            <field name="name">Sales Target Kanban Inherit</field>
            <field name="model">sales.target</field>
            <field name="inherit_id" ref="sales_team.crm_team_salesteams_view_kanban"/>
            <field name="arch" type="xml">
                 <kanban>
                 </kanban>
            </field>
    </record>

我收到以下错误:

ParseError: "Error while validating constraint

Field `color` does not exist
Error context:
View `Sales Target Kanban Inherit`
[view_id: 1870, xml_id: n/a, model: sales.target, parent_id: 682]
<record model="ir.ui.view" id="sales_targets_kanban_inherit_id">
        <field name="name">Sales Target Kanban Inherit</field>
        <field name="model">sales.target</field>
        <field name="inherit_id" ref="sales_team.crm_team_salesteams_view_kanban"/>
        <field name="arch" type="xml">
             <kanban>
             </kanban>
        </field>
</record>

希望提出建议

1 个答案:

答案 0 :(得分:0)

您可以像这样编辑代码:

<record id="crm_team_salesteams_view_kanban" model="ir.ui.view">
        <field name="name">crm.team.kanban</field>
        <field name="model">crm.team</field>
        <field name="inherit_id" ref="sales_team.crm_team_salesteams_view_kanban"/>
        <field name="arch" type="xml">
        <data>
            <xpath expr="//templates" position="before">
                <field name="your_field"/>

            </xpath

          <xpath expr="//div[contains(@class, 'o_kanban_primary_right')]" 
           position="inside">
              <!-- .............. -->
         </xpath>
          </data>
          </field>