Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
465 Vistas

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
Descartar
Autor

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?

Autor

@Desk Enterprise,

It's 18.0 Community Edition.

Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
jul 24
29
1
jul 24
1787
2
ago 23
1942
1
jul 23
4254
0
mar 24
3254