跳至內容
選單
此問題已被標幟
1 回覆
479 瀏覽次數

Hi,


I'd like to know how widgets such as monetary​ or float_time​ can be applied to measure fields when creating a pivot view.


I only learned how to apply a widget in a form view inside <field name=...>. Also I can generate a pivot view action object in model (in Python) and providing context such as pivot_row_groupby​ or pivot_measures​.


Thank you.

頭像
捨棄
作者

Hi Desk,


That's the first thing that I tried. It didn't change anything, and I couldn't find a developer documentation on pivot views, so that's why posted the question.

If that's how simple it's supposed to work, I'm afraid it's another issue with my local settings.


Also how would I achieve widget="..."​ in providing context as in 'pivot_measures': 'field_name'​? like 'pivot_measures': 'field_name:widget_name'​?


Which version are you using?

作者

@Desk Enterprise,

It's 18.0 Community Edition.

最佳答案

Hii,

Define the Widget in the Pivot View XML

Inside the <pivot> view definition, you define measure fields using <field name="..." widget="..."/>.

🧾 Example: Pivot View with monetary and float_time
<record id="my_model_pivot_view" model="ir.ui.view">

  <field name="name">my.model.pivot</field>

  <field name="model">my.model</field>

  <field name="arch" type="xml">

    <pivot string="My Model Analysis">

      <!-- Group-by field -->

      <field name="state"/>

     

      <!-- Measures with widgets -->

      <field name="amount_total" type="measure" widget="monetary"/>

      <field name="duration_hours" type="measure" widget="float_time"/>

    </pivot>

  </field>

</record>

i hope it is use full

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
7月 24
29
1
7月 24
1808
2
8月 23
1962
1
7月 23
4271
0
3月 24
3270