Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
2877 Zobrazení

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 ? 

Avatar
Zrušit
Nejlepší odpověď

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

Avatar
Zrušit
Autor Nejlepší odpověď

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?

 

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
říj 20
2789
0
bře 16
4427
1
dub 15
13132
1
srp 24
2072
2
kvě 24
2782