Extension views on included views

I am trying to add a field in incl-invoice-payment-partner-form. The form is ultimately included in partner-supplier-form (among others).

I have created an extension view with the same name (different id) and added the field. At runtime I can see the extension view in Administration | View Management | All views. I can also see the computed view with a priority of 21 (original incl-invoice-payment-partner-form has a priority of 20). The computed view includes the new field as expected. However the field does not show when I open Purchases | Suppliers.

If I edit the original incl-invoice-payment-partner-form to include the new field directly (instead of extending it through an extension view), the field is shown properly and everything works as expected.

Are extension views supposed to work on included views?

Edit: the extension view is as follows:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<object-views xmlns="http://axelor.com/xml/ns/object-views"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://axelor.com/xml/ns/object-views http://axelor.com/xml/ns/object-views/object-views_5.3.xsd">

    <form name="incl-invoice-payment-partner-form" title="Partner" model="com.axelor.apps.base.db.Partner" id="euroscope-incl-invoice-payment-partner-form" extension="true">
        <extend target="//field[@name='analyticDistributionTemplate']">
            <insert position="after">
                <field name="supplierCommission" canNew="true" hideIf="!isSupplier" />
            </insert>
        </extend>
    </form>              

</object-views>

Edit 2: Axelor version 6.0.5

After a lot of hair-pulling I finally figured it out:

incl-invoice-payment-partner-form is included in partner-form. However the panel-include tag specifies which module contains the included form (from="axelor-account"). This limits the search to that module only and the computed view is ignored. Note that the from attribute is optional. If omitted views from all modules are considered.

The solution is rather simple. Remove the from attribute from that panel-include in partner-form using another extension view, this time however on the partner-form, like this:

<extend target="//panel-include[@view='incl-invoice-payment-partner-form']">
  <attribute name="from" value="" />
</extend>

Note, though, that this requires knowledge of where the form is included from. It cannot handle possible includes from yet unknown modules.

Hope this can help someone else in the future.

1 « J'aime »