<?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.2.xsd">
   
	<grid name="data-config-line-grid" title="Data config line" model="com.axelor.apps.base.db.DataConfigLine">
		<field name="metaModel" />
		<field name="path" required="true" />
		<field name="metaFieldPath"/>
	</grid> 
    
	<form name="data-config-line-form" title="Data config line"
		model="com.axelor.apps.base.db.DataConfigLine" width="large">
		<panel name="mainPanel">
		 	<field name="metaModel" canEdit="false" />
		 	<field name="tabName" />
    		<field name="typeSelect"/>
    		<field name="metaFieldPath" hidden="true" showIf="typeSelect == 0" requiredIf="typeSelect == 0" onSelect="action-object-attrs-metaFieldPath-onselect"/>
      		<field name="path" hidden="true" showIf="typeSelect == 1" requiredIf="typeSelect == 1" colSpan="12"/>
		 	<panel-related name="toExportMetaFieldSetPanel" field="toExportMetaFieldSet" canNew="false" canEdit="false" colSpan="12" 
		 	domain="self.metaModel = :metaModel and (self.relationship is null or self.relationship not in ('ManyToMany','OneToMany'))">
		 		<field name="name" />
		 		<field name="label" />
		 		<field name="typeName" />
		 	</panel-related>
		 	<field name="resetPathSelect" showIf="typeSelect == 0" onChange="action-data-config-line-record-set-record-model"/>
		 	<field name="record" widget="RefSelect" x-related="recordSelectId" selection-in="null" showIf="resetPathSelect == 1 &amp;&amp; typeSelect == 0"/>
		 	<field name="recordSelectId" hidden="true" />
		 	<panel-related name="toDeleteMetaFieldSetsPanel" field="toDeleteMetaFieldSet" canNew="false" canEdit="false" colSpan="12" 
		 	domain="self in (:toExportMetaFieldSet)">
		 		<field name="name" />
		 		<field name="label" />
		 		<field name="typeName" />
		 	</panel-related>
		</panel>
	</form>
	
	<action-record name="action-data-config-line-record-set-record-model" model="com.axelor.apps.base.db.DataConfigLine">
		<field name="record" expr="eval: _parent?.modelSelect" if="resetPathSelect == 1 &amp;&amp; typeSelect == 0"/>
		<field name="recordSelectId" expr="0" if="resetPathSelect == 1 &amp;&amp; typeSelect == 0"/>
		<field name="record" expr="eval: null" if="resetPathSelect != 1 || typeSelect != 0"/>
	</action-record>
  
  	<action-attrs name="action-object-attrs-metaFieldPath-onselect">
  		<attribute name="domain" expr="eval:&quot; self.metaModel = :metaModel AND CONCAT(self.packageName ,'.',self.typeName) = '${_parent?.modelSelect}'&quot;" for="metaFieldPath"/>
	</action-attrs>

</object-views>
