Skip to Content
Menu
This question has been flagged
1 Reply
2058 Views

i find 'create' tag in module 'website_slides' with file 'slide_channel_views.xml' at line 87,there is code :


What is the purpose of this 'create' tag and how it calls related functions? The official cannot find any relevant information. Can anyone answer this? Thank you

Avatar
Discard
Best Answer

control tags in XML define custom controls for the current view. This makes sense if the parent tree view is inside a One2many field.
Does not support any attribute, but can have children: create

Adds a button to create a new element on the current list.
Note: If any create is defined, it will overwrite the default “add a line” button.


The following attributes are supported:

string (required)

The text is displayed on the button.

context

This context will be merged into the existing context when retrieving the default value of the new record.

For example, it can be used to override default values.

The following example will override the default "add a line" button by replacing it with 3 new buttons: "Add a product", "Add a section" and "Add a note".

"Add a product" will set the field 'display_type' to its default value.

The two other buttons will set the field ‘display_type’ to be respectively ‘line_section’ and 'line_note'.


It is going to create the buttons like this:


 
Here you can find about it in the documentation: https://www.odoo.com/documentation/16.0/developer/reference/backend/views.html


Avatar
Discard
Related Posts Replies Views Activity
1
Mar 25
1069
0
Nov 24
1338
0
Jun 24
1411
1
Jun 24
1854
0
Oct 23
1952