Odoo Help


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.


How to change location of a field within a view?

on 12/22/13, 9:11 AM 2,387 views

By developing a custom module, I extended partner model and view with some more fields. Inside view, I added a notebook page containing all these additional fields. So far, so good. What I still need to do is to change location of partner.ref field. I do not want it to be shown at sale & purchase notebook page, but on my own page.

I tried the example code of the OEP documentation by putting it within the section of my new notebook page (see code section below). This shows partner.ref at the location I want, but it is not deleted from its old location and values entered to new location are not persisted. That means, this way it is completely useless. Can you tell me, what I did wrong?

<page string="Internal Notes" position="before">

<page string="Additional Information" colspan="4">

            <!--additional fields -->
              <field name="ref" position="replace"/>
               <field name="cust_category" label="Customer category" select="1" position="before">
                    <field name="ref"  select="1"/>

Your field with replace should close after what you want to put at its place : <field name="ref" position="replace"> <field name="cust_category" label="Customer category" select="1"/> <field name="ref" select="1"/> </field>

And you should try working with xpath it's sometime more simple.

Michael O. Lambert
on 3/25/14, 12:43 PM
Mind And Go
On 12/22/13, 10:25 AM


The code you posted is not well displayed so it could be difficult to really understand what's going wrong there. Anyway, most of time when I have this kind of issue (things not displaying correctly) I make some additionnal tests :

  1. Pass in developper mode and use the form view display item to chek that all your work has been correctly used
  2. Change the priority of the views so that your is surely the first to be used
  3. Create a new view with all my stuff and place it with the max priority

Thanks to that you'll be sure that your view is the appropriate one.

Then, modifying the order of fileds in inherited view is not really easy for maintenance cause, any time you'll have to change/add/delete a module option, you could lost some reference fields you use in your view.

personnaly, I used to recrete my owns view and use them in actions, views etc... so that I'm sure that :

  1. I'm not depending on another view
  2. I'm able to change the priority and still have the possibility to display either mine or openerp's one wherever I'm working
  3. I'm able to deliver my view and use it in other project more easily

Hope it could help

Hi, thank you for your information. Immediately before reading your post, I found the solution by myself: This issue can not be solved in one single inheritance class. I had to 1.) Inherit partner_form to remove (replace) the field, 2.) Inherit it another time to create additional fields and 3.) Inherit the class creating additional fields to re-add the field removed in step 1. This way it works as I like. But your proposal to duplicate all the view to be completely independent of internal structures seems to me very reasonable, too. But how to replace existing partner view without inheritance

on 12/22/13, 10:28 AM

Hy, using priority in view, configuring actions for using the proper view is efficient for solving your issue

Mind & Go, Mind And Go
on 12/22/13, 4:20 PM

here is the doc : https://doc.openerp.com/6.0/developer/2_6_views_events/views/specify_view_to_use/

Mind & Go, Mind And Go
on 12/22/13, 4:21 PM

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

0 follower(s)


Asked: 12/22/13, 9:11 AM
Seen: 2387 times
Last updated: 3/16/15, 8:10 AM