Odoo Help

Welcome!

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.

0

How to add a field on an existing tab?

By
Frank Adler
on 8/11/14, 6:56 PM 975 views

Hi,

To inherit views and add new fields, I have successfully followed the steps described in this link:
http://www.slideshare.net/openobject/how-to-customize-views-menues-of-open-erp-online-in-a-sustainable-way-frederic-gilson

I was also able to create a new tab and use <group> to organise my fields. Now I would like to add a new checkbox "Agent" below the "Supplier" field on a partner's "Sales & Purchases" tab, but the approach seems different. Simply referencing the field to insert after doesn't work.

This is the inherited view I have tried (without luck):

Object: res.partner
Inherited view: res.partner.form

<?xml version="1.0"?>
<field name="supplier" position="after"> 
     <field name="x_agent" /> 
</field>

...the above works fine if I replace "supplier" with "website" since it's a field on the main partner form I guess.

Any clues anyone? Did I inherit the wrong view? How do I find the right one?

Thanks.

 

I noticed that adding a field in the above fashion works generally fine, even on a tab (e.g. placing x_agent after "date" on the same tab works) but still no luck placing the checkbox below the existing supplier checkbox.

Frank Adler
on 8/12/14, 1:28 AM
2

Ray Carnes

--Ray Carnes--
15717
| 9 7 9
Greater Los Angeles, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0 and Odoo 8.0, 9.0 (Since 2012)

Completed Functional and Technical Training.

Major Skills:

  • Needs Discovery and Requirements Analysis;

  • Function and Technical Specifications;

  • Project Planning;

  • Prototyping and Proof of concepts;

  • Data migration;

  • Configuration & Customization (UI and modules);

  • Integration - data, business logic and service levels;

  • Training and Knowledge transfer;

  • Go Live support;

  • Help desk;

  • Version Migration.

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. 

Ray Carnes
On 8/11/14, 7:40 PM

I think you have the right view, you are just anchoring to the wrong instance of the field.

res.partner.form (base.view_partner_form) does contain the field 'supplier' but it is used twice.  Once (invisibly) on the CONTACT tab, and the other on the SALES & PURCHASES tab.

If your field is showing up on the CONTACTS tab (only visible if the record is a company) then you need to use XPATH notation to specifiy WHICH 'supplier' field you want to anchor to.

1
Frank Adler
On 8/12/14, 9:34 PM

Hi Ray, 

Thanks for the tip - you were spot on - the code that worked was:

<?xml version="1.0"?>
<xpath expr="//page[@string='Sales &amp; Purchases']//field[@name='supplier']" position="after">
     <field name="x_agent" />
</xpath>

Thanks!
Frank

 

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

1 follower(s)

Stats

Asked: 8/11/14, 6:56 PM
Seen: 975 times
Last updated: 3/16/15, 8:10 AM