跳至内容
菜单
此问题已终结
1 回复
9481 查看

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!

形象
丢弃
最佳答案

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>
形象
丢弃