Skip to content

Commit

Permalink
endpoint: add basic mixin view
Browse files Browse the repository at this point in the history
As the mixin can be inherited by many other models w/ their view
an isolated basic view is required to avoid pollution and breakage
of inherited views when extending the views of endpoint.endpoint.

In particular, this solves a conflict that came w/ OCA/web-api-contrib#1
  • Loading branch information
simahawk committed Jul 26, 2024
1 parent 8bf71b6 commit 758f2c4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
20 changes: 17 additions & 3 deletions endpoint/views/endpoint_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
<odoo>

<record model="ir.ui.view" id="endpoint_endpoint_form_view">
<field name="name">endpoint.endpoint.form</field>
<field name="model">endpoint.endpoint</field>
<!-- Basic view inheritable by real models -->
<record model="ir.ui.view" id="endpoint_mixin_form_view">
<field name="name">endpoint.mixin.form</field>
<field name="model">endpoint.mixin</field>
<field name="arch" type="xml">
<form>
<header />
Expand Down Expand Up @@ -90,6 +91,19 @@
</field>
</record>

<record model="ir.ui.view" id="endpoint_endpoint_form_view">
<field name="name">endpoint.endpoint.form</field>
<field name="model">endpoint.endpoint</field>
<field name="inherit_id" ref="endpoint.endpoint_mixin_form_view" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<form position="attributes">
<!-- Needed just to make further inheritance happy -->
<attribute name="name">real</attribute>
</form>
</field>
</record>

<record model="ir.ui.view" id="endpoint_endpoint_search_view">
<field name="name">endpoint.endpoint.search</field>
<field name="model">endpoint.endpoint</field>
Expand Down
4 changes: 2 additions & 2 deletions endpoint_auth_api_key/views/endpoint_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
<odoo>

<record model="ir.ui.view" id="endpoint_endpoint_form_view">
<record model="ir.ui.view" id="endpoint_mixin_form_view">
<field name="model">endpoint.endpoint</field>
<field name="inherit_id" ref="endpoint.endpoint_endpoint_form_view" />
<field name="inherit_id" ref="endpoint.endpoint_mixin_form_view" />
<field name="arch" type="xml">
<group name="auth" position="inside">
<field
Expand Down

0 comments on commit 758f2c4

Please sign in to comment.