This question has been flagged
1 Reply
9225 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.

Avatar
Discard
Best Answer

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 :)

Avatar
Discard
Author

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