Axelor Doc

Portlets in form view

One use case views Portlet in a form view is to display any other view in a form for example:

  • graphic
  • a set of records related to the current record (as all orders for a contact)

Action-view

An action-view with any one area can restrict records to display. Here's an example.

<action-view name="sale.orders.by.customer" name="Sale Orders by Customer" model="com.axelor.sale.db.Order">
  <view type="grid" name="sale-order-grid2"/>
  <domain>self.customer.id = :id</domain>
</action-view>

In the form view, this action is called with an element portlet .

<form title="Customer" cols="4">
    <field name="firstName"/>
    ...
    <portlet action="sale.orders.by.customer" colSpan="4" height="300" canSearch="false"/>
    ...
</form>

Using a portlet is recommended especially when the number of records to display is great. Thanks to the filter and including the paging, a particular record may be located quickly. This is not possible with related fields or O2M M2M.

Shortcut to view

A direct shortcut to a view can be used in the attribute action and thus avoids creating an action just this purpose.

Example shortcut to a view in a portlet
...
  <portlet action="my.sale.orders" colSpan="4"/>
...
  <portlet action="chart:chart.sales.per.month" colSpan="4" name="p1"/>
...

The first portlet is a similar example in case primary use. This is an action view .

portlet The second, is a shortcut to a graphical view with the use of the prefix chart: . On the other prefixes are used to display other types of views ( grid: , html: , search: ...).

Such shortcuts are also available to define actions on any other type of field especially pimples:

...
<button title="Visit us!" onClick="html:http://axelor.com" />
...
<button title="Sale Search..." onClick="search:sale-order-search" />

The only drawback of this shortcut is the inability to use a context or domain.

Refresh a portlet

Like action action-attrs with named attribute refresh allows you to refresh a portlet view:

<action-attrs name="some.name">
  <attribute for="p1" name="refresh" expr="true"/>
</action-attrs>