Odoo Help


How to control the order of fields in your new table? [Closed]

Dale E. Moore
on 2/15/13, 7:28 PM 2,421 views

The Question has been closed

Ray Carnes
on 03/09/2014 00:24:40

When I create a new table the field order is always different than what I specified in the

class newClass(osv.osv):
    _columns = {
        fieldA:fields.char('Field A',size=10),
        fieldB:fields.char('Field B',size=10),
        fieldC:fields.char('Field C',size=10),

Is there some way I can force the fields to be created in the new table in the order I've specified?

Why do you need the fields in a specific order? ORM persists the models you define as OpenERP see's fit - the order shouldn't matter. It is not important to the Web client, SQL or other python code since you can access them in any order.

Ray Carnes
on 2/15/13, 11:11 PM

In the academic sense, both database fields and database rows are 'sets' rather than 'ordered lists'.

Ray Carnes
on 2/15/13, 11:11 PM

If you really need to do this, define your own SQL to create the table.

Ray Carnes
on 2/15/13, 11:12 PM

You would do this by using the tag: _auto = False to tell OpenERP you will code the persistence of this model, then writing a def init(self,cr): funtion. Then you can do cr.execute and use SQL.

Ray Carnes
on 2/15/13, 11:23 PM

Thanks Ray; your comments are very helpful. If you would compose the last comment as an answer, I would be happy to grant you the cred.

Moore Works, Dale E. Moore
on 2/16/13, 12:31 AM

To answer your question, I don't like the default field order that appears in a view. Perhaps I should be asking how to order the fields in the view.

Moore Works, Dale E. Moore
on 2/16/13, 12:33 AM

To change the order of fields in a view (and I can see why you would want to do this) you need to edit the XML definition of the view. Settings -> User Interface -> Views. You should really create your own view that inherits and modifies a base view, rather than changing it.

Ray Carnes
on 2/16/13, 2:44 AM

If you haven't created your own view for your model, OpenERP will generate one on the fly, which is why it would look messy.

Ray Carnes
on 2/16/13, 2:45 AM

Ray Carnes

--Ray Carnes--
| 9 7 9
Keyport, United States
--Ray Carnes--

Senior ERP Analyst

OpenERP 6.1, 7.0; Odoo 8.0, 9.0, 10.0 and 11.0.

Completed Odoo Functional and Technical Training.

Functional Areas:

  • CRM/Sales

  • Inventory

  • Manufacturing

  • Accounting

  • Purchasing

Major Skills:

  • Business Process Reengineering

  • Efficiency Consulting

  • User Needs and GAP Analysis;

  • Functional and Technical Design;

  • Prototyping and Proof of Concepts;

  • Requirements Specifications;

  • Agile Implementation;

  • Data Migration;

  • Configuration & Customization (UI and code);

  • Integration - Odoo and non Odoo Applications and Services;

  • Training and Knowledge Transfer;

  • Go Live Support;

  • Helpdesk;

  • Version Upgrades and Migration.

  • Accounting Expert.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

I am a skilled Communicator and I only take the serious things seriously!

Ray Carnes
On 2/16/13, 2:41 AM

You would do this by using the tag: _auto = False to tell OpenERP you will code the persistence of this model, then writing a def init(self,cr): funtion. Then you can do cr.execute and use SQL.

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: 2/15/13, 7:28 PM
Seen: 2421 times
Last updated: 3/16/15, 8:10 AM