Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
7911 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Autor Nejlepší odpověď

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
Zrušit

Thanks, this helped me today!

Related Posts Odpovědi Zobrazení Aktivita
1
srp 15
8251
0
bře 15
4918
0
pro 24
9477
3
zář 24
21700
5
pro 24
52987