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

Hi,

as some people may know, using "widget="monetary" options="{'currency_field': 'currency_id'}" in form view, works, but doesn't work in List Views. By that, some of my list views become really confusing, because for each price column, I have to add a separate currency column.

I can't believe that this "monetary" widget still does not exist for listviews. Has anyone heard about an existing extension for odoo? Thanks!

Avatar
Descartar
Mejor respuesta

Hello,


The Monetary widget can be used in list views as well, but the "currency_id" field must be present within the tree itself as well.


For example, my invoice form did not have the currency for the price_unit field, so I was able to add it with the following custom view:


<record id="invoice_pretty_price_form_tree" model="ir.ui.view">
 <field name="name">Account Invoice Pretty Price Form Tree</field>
 <field name="model">account.invoice</field>
 <field name="inherit_id" ref="account.invoice_form"/>
 <field name="arch" type="xml">
<xpath expr="//field[@name='invoice_line_ids']/tree/field[@name='price_unit']" position="before">
            <field name="currency_id"/>
        </xpath>
        <xpath expr="//field[@name='invoice_line_ids']/tree/field[@name='price_unit']" position="replace">
            <field name="price_unit" widget="monetary" options="{'currency_field': 'currency_id'}"/>
        </xpath>
    </field>
</record>
Avatar
Descartar