<?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="template-rule-grid" title="Template rules" model="com.axelor.apps.base.db.TemplateRule">
        <field name="name"/>
        <field name="metaModel" form-view="meta-model-form" grid-view="meta-model-grid"/>
    </grid>
    
    <form name="template-rule-form" title="Template rule" model="com.axelor.apps.base.db.TemplateRule" onNew="action-template-rule-record-new" width="large">
    	<panel name="mainPanel">
	        <field name="name"/>
	        <field name="metaModel" form-view="meta-model-form" grid-view="meta-model-grid"/>
	        <panel-related name="templateRuleLineListPanel" field="templateRuleLineList" colSpan="12" form-view="template-rule-line-form" grid-view="template-rule-line-grid"/>
        </panel>
    </form>
    
    <action-record name="action-template-rule-record-new" model="com.axelor.apps.base.db.TemplateRule">
    	<field name="metaModel" expr="eval: (_parent?.targetSelect == 1) ? __repo__(MetaModel).all().filter('self.name = \'Partner\'').fetchOne() : __repo__(MetaModel).all().filter('self.name = \'Lead\'').fetchOne()" if="_parent?.targetSelect"/>
    </action-record>
    
</object-views>