<?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">
    
    <form name="duplicate-object-wizard-form" title="Merge duplicated" cols="2" model="com.axelor.apps.base.db.Wizard" onNew="action-default-object-name" >
		<panel name="mainPanel">
			<panel name="duplicateObjectsPanel">
		   		<field name="$duplicateObjects" title="Duplicate" type="one-to-many" canView="false" readonly="true" target="com.axelor.apps.base.db.Wizard" grid-view="duplicate-object-grid" colSpan="12" />
		   	</panel> 
		   	<panel name="actionsPanel" >
		   		<button name="addOriginalBtn" icon="fa-arrow-right" colSpan="2" onClick="action-method-add-original" colOffset="1"/>
				<field name="$originalObject" title="Original" readonly="true" colSpan="8" type="many-to-one" canView="false" target="com.axelor.apps.base.db.Wizard" colOffset="1"/>
				<button name="replaceDuplicatesBtn" showIf="$originalObject" title="Merge duplicated" onClick="action-validate-replace-object-message,action-method-remove-duplicate" colSpan="6" colOffset="4"/>
			</panel>
	   </panel>
	</form>
  
  
	<grid model="com.axelor.apps.base.db.Wizard" title="Duplicate Object" name="duplicate-object-grid">
		<field name="recordId" />
		<field name="recordName" />
	</grid>
	
	<form model="com.axelor.apps.base.db.Wizard" title="Check duplicate" name="wizard-check-duplicate-form">
		<panel-related name="fieldsSetPanel" field="$fieldsSet" title="Fields to select duplicate" domain="self.metaModel.fullName = :_contextModel AND (relationship = null OR relationship = 'ManyToOne')" canNew="false" canEdit="false" colSpan="12" type="many-to-many" target="com.axelor.meta.db.MetaField" grid-view="meta-field-light-grid"/>
  		<panel name="mainPanel" >
    		<button name="showDuplicateBtn" title="Show" colSpan="6" onClick="action-base-method-show-duplicate"/>
  		</panel>
	</form>
	
	<action-view name="action-duplicate-object-wizard-open" model="com.axelor.apps.base.db.Wizard"  title="Remove duplicates">
			<view type="form" name="duplicate-object-wizard-form"/>
			<view-param name="popup" value="reload"/>
			<view-param name="show-toolbar" value="false"/>
	     <view-param name="show-confirm" value="true"/>
	     <view-param name="popup-save" value="false"/>
	     <context name="_ids" expr="eval:_ids"/>
	     <context name="_modelName" expr="eval:_model"/>
	</action-view>
	
	<action-method name="action-general-check-duplicate-records">
		<call class="com.axelor.apps.base.web.DuplicateObjectsController" method="callCheckDuplicateWizard"/>
	</action-method>
   
	<action-method name="action-default-object-name">
			<call class="com.axelor.apps.base.web.DuplicateObjectsController" method="defaultObjects"/>
	</action-method>
	
 	<action-method name="action-method-remove-duplicate">
		<call class="com.axelor.apps.base.web.DuplicateObjectsController" method="removeDuplicate"/>
	</action-method>
	
	<action-method name="action-method-add-original">
		<call class="com.axelor.apps.base.web.DuplicateObjectsController" method="addOriginal"/>
	</action-method>
	
	<action-method name="action-base-method-show-duplicate">
		<call method="showDuplicate" class="com.axelor.apps.base.web.DuplicateObjectsController"/>
	</action-method>
	
	<action-validate name="action-validate-select-object-message">
		<error message="Please select multiple records" if="_ids == null ||  _ids.size() &lt; 2" />
	</action-validate>
	
	<action-validate name="action-validate-replace-object-message">
		<alert message="Are you sure wants to replace ?"  />
	</action-validate>
	
</object-views>