This question has been flagged
1 Reply
10123 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">

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

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.

Best Answer

Hy,

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

Avatar
Discard
Author

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

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

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