Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
463 Visualizzazioni

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
Abbandona
Autore

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?

Autore

@Desk Enterprise,

It's 18.0 Community Edition.

Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
lug 24
29
1
lug 24
1785
2
ago 23
1938
1
lug 23
4253
0
mar 24
3249