Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

openerp v7 - search view - how to add group by currency

By
Yves Goldberg
on 7/4/14, 1:02 PM 3,531 views

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

1
Adrian Merrall
On 7/4/14, 11:51 PM

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>

1
Yves Goldberg
On 8/13/14, 11:07 AM

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.

 

Thanks, this helped me today!

Billiard R Made
on 12/12/15, 5:38 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/4/14, 1:02 PM
Seen: 3531 times
Last updated: 3/16/15, 8:10 AM