Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
450 Vues

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.

Avatar
Ignorer
Auteur

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?

Auteur

@Desk Enterprise,

It's 18.0 Community Edition.

Meilleure réponse

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

Avatar
Ignorer
Publications associées Réponses Vues Activité
1
juil. 24
29
1
juil. 24
1781
2
août 23
1930
1
juil. 23
4244
0
mars 24
3246