簡體   English   中英

數據透視表中的百分比符號(圖表視圖)Odoo V8

[英]Percentage Symbol in Pivot Table (Graph View) Odoo V8

我想在數據透視表 Odoo v8 中的 float in measure 類型的字段中添加一個百分比符號 (%)

在此處輸入圖片說明

我希望在此度量列中以百分比形式顯示數字

我在表中的結果:50.00

我想要的結果:50.00%

這是我的代碼 xml :

<record id="view_order_product_graph" model="ir.ui.view">
     <field name="name">forecast_report.graph</field>
     <field name="model">forecast_report</field>
     <field name="arch" type="xml">
         <graph string="Forecasts Analysis" type="pivot">
            <!--  <field name="date" interval="month" type="col"/> -->
             <field name="forecast_quantity" type="measure"/>
             <field name="product_uom_qty" type="measure"/>
             <field name="forecast_subtotal" type="measure"/>
             <field name="price_total" type="measure"/>
             <field name="percentage_forecast"  type="measure"/>
             <field name="product_id" type="row"/>
         </graph>
     </field>
</record>

predict_percentage 的代碼 python :

'percentage_forecast': fields.float('% Sales Forecast', readonly=True,  group_operator = 'avg'),

感謝您的幫助

您可以在下一行之后在XML文件中手動添加%號。

    <field name="percentage_forecast"  type="measure"/>

您可以添加一個小部件,試試這種方式:


<field name="percentage_forecast"  type="measure" widget="percentage"/>

我以這種方式使用它,它對我有用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM