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

So now product.template has several notebooks that end in a grid form. How can I add a field at the end of the form outside the grid? I used to add them after certain fields as follows:


<record id="product_template_only_form_view_inherit_custom" model="ir.ui.view">
<field name="name">product.template.product.form.inherited.custom</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<field name="description_purchase" position="after">
<field name="purchase_order_ids" readonly="1"/>
</field>
</field>
</record>

But that won't work anymore, since it gets added inside the grid, and I'm inserting tree views that are wide.

Any insight? I'm working on Odoo 17, but I'm interested in a more generic answer if possible.

Thanks.

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

Hi Apiuser,

I assume you are trying to do as below (I am using products one2many field instead of your example: purchase_order_ids)

If this is what you are trying to do, you can try this code.

<!-- after arch -->
  <xpath expr="//field[@name='description_purchase']" position="after">
    <field name="product_variant_ids"/>
  </xpath>
Ảnh đại diện
Huỷ bỏ
Tác giả

Hi, thanks for your time.
I had already tried it that way, and even tho all the fields are shown, they are not where I would like them to be. I tried both the following, and the first one puts the table ouside the notebook, and the second one does not print the table:
1. <xpath expr="//notebook" position="after">
2. <xpath expr="//notebook//page[@name='purchase']" position="after">

I'm trying to exit this grid where you have the 2 columns, so this table can go from left to right of the screen instead of beeing placed on the right column but inside the Purchase tab.

oh you don't want the label? in my case it's the word "Products"

If that's what you want to achieve. you can try this, adding the nolabel and colspan attribute.
<field name="product_variant_ids" nolabel="1" colspan="2"/>

Tác giả

No, I don't need the title, but without setting nolabel="1" I already printed it with no title.

yeah, I just noticed that you put the field outside of the <group> tag.

Tác giả Câu trả lời hay nhất

Finally solved it. To place an object inside a notebook page, but at the end of said page:

<xpath expr="//notebook//page[@name='page_name']" position="inside">

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 11 24
960
3
thg 7 25
1408
1
thg 6 25
1341
2
thg 5 25
1387
1
thg 5 25
727