Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
7900 Vistas

We have both sales and purchase orders nominated in different currencies.

All tree views are simply adding the figures (which is totally useless and unacceptable by anyone who is not a programmer :) ).

I want to add a 'group by' filter in the search view using "currency_id". But it doesn't work as it seems I cannot use this type of field here.

any other field related to the currency I could use? Or any other idea to make sense of these tree views?

 

TIA

Avatar
Descartar
Mejor respuesta

On sale order, currency_id is a related field based on pricelist_id so you could use pricelist_id, or you could create a new module, inherit sale.order and override the field to make it stored.  I think a simple store=True would be fine as the currency on a price list is unlikely to change.

 

On Invoices, create a new view in your module, inherit from the invoice search view and add the currency_id in as a group by.

       <record id="view_my_module_account_invoice_search" model="ir.ui.view">
            <field name="name">my.module.account.invoice.search</field>
            <field name="model">account.invoice</field>
            <field name="inherit_id" ref="account.view_account_invoice_filter"/>
            <field name="arch" type="xml">
                <xpath expr="//group/filter[@string='Due Date']" position="after">
                    <filter string="Currency" domain="[]" context="{'group_by':'currency_id'}"/>
                </xpath>
            </field>
        </record>

Avatar
Descartar
Autor Mejor respuesta

For infos: step-by-step:

1. activate developper mode

2. go to sales / Sales order

3. select "edit search view"

4. insert "<filter string="Currency" icon="terp-partner" domain="[]" context="{'group_by':'pricelist_id'}"/>" just after the line starting with " <filter string="Order Date" icon..."

5. go to reporting / sales analysis

6. redo point 3 & 4 here too.

Voila.

Thank you Adrian.

 

Avatar
Descartar

Thanks, this helped me today!

Publicaciones relacionadas Respuestas Vistas Actividad
1
ago 15
8249
0
mar 15
4913
0
dic 24
9470
3
sept 24
21674
5
dic 24
52955