Odoo Help


Changing Default Column Sort in Work Orders

Alex Gallien
on 7/2/14, 8:06 PM 2,068 views

Currently Work Orders is sorting by what appears to be Sequence Number, which makes it hard to see the state of different MOs. Is it possible to have the Work Order page automatically sort by Manufacturing Order instead? This would make the page much more readable at a glance. Thanks!


Vasiliy Birukov

--Vasiliy Birukov--
| 7 6 8
Russian Federation
--Vasiliy Birukov--

Help develop and implement any project on base Odoo.

Vasiliy Birukov
On 7/3/14, 3:46 AM


_order = 'production_id'

to class mrp_production_workcenter_line

Thanks, that worked for me. Is it possible to have it sort by Manufacturing Order and then sequence? So that the MOs are grouped together but in sequential order? I have tried both _order = 'production_id, sequence' and _order = 'sequence, production_id', but neither of these seem to do what I want. Thanks!

Alex Gallien
on 7/3/14, 3:38 PM

Try add new field: 'sequence_mo': fields.related('production_id', 'sequence', string="Sequence MO", type="integer"), and _order = 'production_id, sequence_mo'

Vasiliy Birukov
on 7/3/14, 11:53 PM

I tried this, but ended up getting an error - ProgrammingError: column "sequence_mo" does not exist. Any resin why that might be? I tried moving the _order line below the _columns line but that didn't work either.

Alex Gallien
on 7/8/14, 3:40 PM

Are you define this field in mrp_production_workcenter_line?

Vasiliy Birukov
on 7/9/14, 2:53 AM

Yeah, definitely. I put my code in a new answer below if you want to take a look.

Alex Gallien
on 7/9/14, 12:28 PM
Alex Gallien
On 7/9/14, 12:28 PM

wowas - here is my code:


from openerp.osv import osv, fields

class mrp_production_workcenter_line(osv.osv):

    _inherit = 'mrp.production.workcenter.line'

    _order = 'production_id, sequence_mo'

    _columns = {


     'sequence_mo':fields.related('production_id','sequence',type='integer',string='Sequence MO'),


I'am sorry, I fogot attr for store to DB. Please try: 'sequence_mo':fields.related('production_id','sequence',type='integer',string='Sequence MO',store=True),

Vasiliy Birukov
on 7/10/14, 5:34 AM

I got: KeyError: "Field 'sequence' does not exist in object 'browse_record(mrp.production, 2)', which make sense because 'sequence' is defined in mrp.workcenter.line, not mrp.production, and 'production_id' is a many2one pointing to mrp.production. I feel like it should work just as _order = 'production_id, sequence' but I don't know if that syntax is correct. Thanks for your help though, let me know if anything else pops in to your head.

Alex Gallien
on 7/10/14, 1:32 PM

Yes, you need define field sequence in mrp.production like in mrp.workcenter.line, if you need sort by MO sequence. If you need sort by WO sequence, then you can use _order = 'production_id, sequence' (It will sort first by field 'name' of MO and then sort by field 'sequence' of WO).

Vasiliy Birukov
on 7/11/14, 12:06 AM

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 7/2/14, 8:06 PM
Seen: 2068 times
Last updated: 3/16/15, 8:10 AM