コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
2942 ビュー

I need to add 3 optional columns to an existing form view, with the menu on the right side with the three dots.(The one to add columns or remove them)

Right there I need to add 3 columns to choose:

  • Internal reference
  • Manufacturer reference I
  • Manufacturer

This is my current view:

xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record model="ir.ui.view" id="view_inventory_form_inh">
<field name="name">view.inventory.form.inhfield>
<field name="model">stock.inventoryfield>
<field name="inherit_id" ref="stock.view_inventory_form" />
<field name="arch" type="xml">
<field name="location_ids" position="before">
<field
name="manufacturer_ids"
widget="many2many_tags"
domain="[('is_manufacturer', '=', True)]"
attrs="{'invisible':[('filter','!=','manufacturers')],
'readonly': [('state', '!=', 'draft')]}"
/>
field>
field>
record>
odoo>

I already added the fields in the model. 

Does anybody know how I add these columns in the view ? 

アバター
破棄
最善の回答

Hi John,

We can create a dynamic tree view (add optional columns in three dots) by providing an attribute called "optional'.

for example:

To show the optional column by default:

<field name="FIELD_NAME" optional="show"/>

To hide the optional column by default:

<field name="FIELD_NAME" optional="hide"/>


Now we can change the field's visibility by checking and unchecking the checkbox in the three dots.

Regards

アバター
破棄
著作者 最善の回答

Do I also need an xpath-expression? Because i want to show fields of the parent view and also fields that are defined in the same module in the model class, how can I use them in the view ?

What kind of xpath-expression do I need in this case? Or is there any other way?

 

アバター
破棄
関連投稿 返信 ビュー 活動
1
10月 20
2817
0
3月 16
4475
1
4月 15
13239
1
8月 24
2170
2
5月 24
2894