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

How to sort a list on a one2many fields?

By
Anirudh Lou
on 8/3/15, 1:34 AM 914 views


How can i sort list on a one2many field? This is the situation:

1.In class account_move some of it's field is:

    ...
_columns = {
...
'line_id' : fields.one2many('account_move_line','move_id','Account Move Line'),
}

2.In class  account_move_line

    ...
_columns = {
...
move_id : fields.many2one('account_move','Account Move'),
account_id : fields.many2one('account_account','Account'),
}

My problem now is that from the view of account_move when i print its report the account_id is not sorted. So, does anyone who knows how to sort this account_id? By the way i am using Jasper Report.

Thanks for any help/suggestion.

1

Drees Far

--Drees Far--
1130
| 5 2 6
Tunis, Tunisia
--Drees Far--
Drees Far
On 8/3/15, 5:21 AM

I found a way to manage this, downloading this module:

https://www.odoo.com/apps/modules/7.0/one2many_sorted/

Then, you overrided the one2many whose order you want to alter, in your case the field was line_id.

Regards.

Good Luck :)

Is it applicable for the id of account I'd?

Anirudh Lou
on 8/3/15, 6:33 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: 8/3/15, 1:34 AM
Seen: 914 times
Last updated: 8/11/15, 5:58 PM