Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
7405 Lượt xem

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.

 

Ảnh đại diện
Huỷ bỏ
Tác giả

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.

Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

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

 

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 8 21
66992
1
thg 1 18
7277
1
thg 11 24
1599
5
thg 7 24
92857
1
thg 12 23
3027