なぜ私はこのビューをOdooで正常に拡張できないのか分かりません。私は、販売ダッシュボードのかんばんのカードのボタンの1つにいくつかのコンテンツを追加しようとしています。Odooのビューを拡張しても機能しない
ベースビューはcrm.team.dashboard
で、次のようなアーキテクチャを持っています
<?xml version="1.0"?>
<kanban class="oe_background_grey o_kanban_dashboard o_salesteam_kanban" create="0" js_class="sales_team_dashboard">
<field name="name"/>
<field name="user_id"/>
<field name="member_ids"/>
<field name="color"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="#{kanban_color(record.color.raw_value)}">
<div class="o_kanban_card_header">
<div class="o_kanban_card_header_title">
<div class="o_primary"><field name="name"/></div>
</div>
<div class="o_kanban_manage_button_section">
<a class="o_kanban_manage_toggle_button" href="#">More <i class="fa fa-caret-down"/></a>
</div>
</div>
<div class="container o_kanban_card_content o_visible">
<div class="row">
<div class="col-xs-6 o_kanban_primary_left" name="to_replace_in_sale_crm">
</div>
<div class="col-xs-6 o_kanban_primary_right">
</div>
</div>
</div><div class="container o_kanban_card_manage_pane o_invisible">
<div class="row">
<div class="col-xs-4 o_kanban_card_manage_section o_kanban_manage_view">
<div class="o_kanban_card_manage_title">
<span>View</span>
</div>
</div>
<div class="col-xs-4 o_kanban_card_manage_section o_kanban_manage_new">
<div class="o_kanban_card_manage_title">
<span>New</span>
</div>
</div>
<div class="col-xs-4 o_kanban_card_manage_section o_kanban_manage_reports">
<div class="o_kanban_card_manage_title">
<span>Reports</span>
</div>
</div>
</div>
<div t-if="widget.editable" class="o_kanban_card_manage_settings row" groups="sales_team.group_sale_manager">
<div class="col-xs-8">
<ul class="oe_kanban_colorpicker" data-field="color"/>
</div>
<div class="col-xs-4 text-right">
<a type="edit">Settings</a>
</div>
</div>
</div>
</div>
</t>
</templates>
</kanban>
かんばんカードにオリジナルの「引用」ボタンを追加し、このいずれかを拡張ビューがあります。それはcrm.team.kanban
ビューだと、それは次のようなアーキテクチャを持っています
<?xml version="1.0"?>
<data>
<xpath expr="//templates" position="before">
<field name="use_quotations"/>
<field name="use_invoices"/>
<field name="invoiced"/>
<field name="invoiced_target"/>
<field name="currency_id"/>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_primary_right')]" position="inside">
<div class="row mb4" t-if="record.use_invoices.raw_value">
<div class="col-xs-8">
<a name="266" type="action">
Sales to Invoice
</a>
</div>
<div class="col-xs-4 text-right">
<field name="sales_to_invoice_amount" widget="monetary"/>
</div>
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_primary_left')]" position="inside">
<button class="btn btn-primary" name="267" type="action">Quotations</button>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_primary_right')]" position="after">
<div t-if="record.invoiced_target.raw_value" class="col-xs-12 o_kanban_primary_bottom" groups="sales_team.group_sale_manager">
<field name="invoiced" widget="progress" title="Invoicing" options="{'current_value': 'invoiced', 'max_value': 'invoiced_target', 'editable': true, 'edit_max_value': true, 'on_change': 'update_invoiced_target'}"/>
</div>
<div t-if="!record.invoiced_target.raw_value" class="col-xs-12 o_kanban_primary_bottom text-center" groups="sales_team.group_sale_manager">
<a href="#" class="sales_team_target_definition o_inline_link">Click to define a team target</a>
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_view')]" position="inside">
<t t-if="record.use_quotations.raw_value">
<div>
<a name="267" type="action" class="o_quotation_view_button">Quotations</a>
</div>
<div>
<a name="265" type="action">Sales Orders</a>
</div>
</t>
<div t-if="record.use_invoices.raw_value" groups="account.group_account_invoice">
<a name="268" type="action">Invoices</a>
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_new')]" position="inside">
<div t-if="record.use_quotations.raw_value">
<a name="272" type="action">
Quotation
</a>
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_reports')]" position="inside">
<t t-if="record.use_quotations.raw_value">
<div>
<a name="269" type="action">
Quotation
</a>
</div>
<div>
<a name="270" type="action">
Sales
</a>
</div>
</t>
<div t-if="record.use_invoices.raw_value" groups="account.group_account_invoice">
<a name="271" type="action">
Invoices
</a>
</div>
</xpath>
</data>
私の目標は、それが「引用(10)」のようなものを言うので、「引用」ボタンで、いくつかの余分なテキストを追加することです。私はcrm.team.dashboard
から継承x_crm.team.dashboard
と呼ばれる新しいビューを作成し、それを次のアーキテクチャ与えた:私はダッシュボードを表示するとき
<?xml version="1.0"?>
<data>
<xpath expr="//div[contains(@class, 'o_kanban_primary_left')]/button" position="inside">
Quotations (Test)
</xpath>
</data>
は、しかし、私の変更が表示されないようにします。私は元の "見積り"ボタンを見るだけです。私は過去にビューを拡大していましたが、うまくいきましたが、この場合は何か不足しているようです。
私が間違っていることを知っている人はいますか?
実際にボタンの要素に 'position =" inside "を使用しようとしていたようです。 Odooはそれを好きではなかった。私が全て同じものを使い、 'position = replace'を使うと、うまくいきます。私は、ボタンを置き換えるだけのコードを複製することを避けようとしていましたが、それを行う唯一の方法だと思われます。 – flyingL123