Odoo add fields for the development tutorial form view 3-

We have created a new field for the partner model, but still not visible to the user, to achieve this we have to add operations in the respective views. Go back to the aforementioned res.partner model details page, click the Views tab, we can see that each view defined modules. As can be seen, each view is a database record, modify, add, or view records with immediate effect, the next time you load the view when you can see:

Form add a field view

View list there are some caveats, we see a different view types (View Type), such as a form view (Form), the tree list view (Tree), search View (Search) and Kanban view (Kanban). Search view refers to the upper right corner of the search box filtering options. Other methods of data display view also vary, a list of the basic type and form views (see for details).

"Tips: tree (Tree) and list views (List) actually the same view, in fact Odoo in the list view, the name of the tree view is generated by historical reasons - in the past a tree view list hierarchy to show. "

It can be seen that multiple definitions of the same type of view ordering may be more clearly seen by the View Type. Each type of view (e.g., form view) may have one or more view definitions base (containing an empty field of view inheritance). Action menu items using the window (Window Action) can use to specify the base view, if not defined, will use the ranking value (Sequence) minimum, which can be regarded as the default view. Click on the view, you can see all the details contains the sort of value, including in the form

Each base view can have multiple extensions, called inheritance view. Each view can add modifications to inherit base view, such as adding to the existing form fields.
"Tips: Inheritance view itself can be inherited by other views, then the outermost layer of the inner layer succession after succession executive role in the base view."
Res.partner model will contain many of the view definition, because many of our similar applications needs to be extended. An alternative method is to enter a particular need to expand our view, the use of developer tools menu to edit it. This can also be used to see whether a view is used somewhere in the user interface. Here we have to operate:
1. Click the Contacts application displays contact card list, and then click on any business card into the appropriate form view:
2. In the form view screen, click the Developer Tools menu (upper right corner of the debug icon) and select Edit View (EditView: form), then you can see the previous model of the same page view details of the form, but the show on the actual definition of the use of base view. That is res.partner.form view, you can see the module owner by External ID. This place is base.view_partner_form, so we know that this view belongs to the base module. Architecture in the field, we can see the base view definition XML code. We can edit the structure view and add
3. Use the View tab inheritance we can add extensions view of base view:
Structure I. First, we need to select an element as an extension point, we can see the base view in the original view that contains a selection of XML element name attribute in most cases is an element of choice, here we select elements
II now, click the Developer tools menu, and then click edit view (edit view: Form)., select inherited view (Inherited views) tags back the aforementioned interface, and then click Add a line at the bottom of the link
. III will pop called Create Views which inherit from this one window, fill in the following
⚫ the Name View: the Contacts - the Custom "Is Work Team" In Flag
⚫ Architecture: input following XML code
< Field name = "category_id" position = "After" >
< Field name = "x_is_work_team" />
</ Field >

⚫ other important fields, such as Model, View Type and Inherited View defaults will be
IV until you click the Save & Close button, and then in the Edit View:. Form window, click the Save button to reload the page contact form view that the Save Changes You can view the changes, you can use shortcut keys F5 in Tarsus browser to reload the page. Then open to any contact card, you can see at the right side Tags field will be more of a new field

More Tutorials: https://www.erpdaxue.cn/odoo/odoo-teach/

Guess you like

Origin www.cnblogs.com/odoo14/p/12629135.html