<?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="analytic-account-grid" title="Analytic Accounts" model="com.axelor.apps.account.db.AnalyticAccount">
        <field name="code" x-bind="{{code|unaccent|uppercase}}"/>
        <field name="name"/>
        <field name="analyticAxis" form-view="analytic-axis-form" grid-view="analytic-axis-grid"/>
        <field name="parent" form-view="analytic-account-form" grid-view="analytic-account-grid"/>
    </grid>
    
    <tree name="analytic-account-tree" title="Analytic accounting account">
        <column name="name" type="string"/>
         <column name="code" type="string"/>
         
        <node model="com.axelor.apps.account.db.AnalyticAccount" domain="self.parent is null" onClick="action-analytic-account-view-account-onchange-view" > 
            <field as="name" name="name"/>
             <field as="code" name="code"/>
        </node>
        
        <node model="com.axelor.apps.account.db.AnalyticAccount" parent="parent" draggable="true" onClick="action-analytic-account-view-account-onchange-view" >
            <field as="name" name="name"/>
            <field as="code" name="code"/>
        </node>
    </tree>
    
    <form name="analytic-account-form" title="Analytic Account" model="com.axelor.apps.account.db.AnalyticAccount"  >
        <panel name="mainPanel">
	        <field name="code" x-bind="{{code|unaccent|uppercase}}"/>
	        <field name="name"/>
	        <field name="analyticAxis" form-view="analytic-axis-form" grid-view="analytic-axis-grid"/>
	        <field name="parent" form-view="analytic-account-form" grid-view="analytic-account-grid"/>
        </panel>
    </form>
    
    <form name="analytic-account-info-form" title="Analytic Account" model="com.axelor.apps.account.db.AnalyticAccount" width="large">
		<panel name="mainPanel" title="Analytic Account details" readonly="true">
			<field name="code" x-bind="{{code|unaccent|uppercase}}" colSpan="6" css="bold"/>
			<field name="name" colSpan="6" css="bold"/>
			<field name="analyticAxis" title="Account Type" colSpan="6"/> 
			<field name="parent" form-view="analytic-account-info-form" grid-view="analytic-account-grid" colSpan="6"/>
		</panel>
	</form>
	
	<action-view name="action-analytic-account-view-account-onchange-view" title="Analytic Accounts"
		model="com.axelor.apps.account.db.AnalyticAccount" >
		<view type="form" name="analytic-account-info-form" />
		<view-param name="popup" value="reload"/>
        <view-param name="show-toolbar" value="false"/>
  		<view-param name="show-confirm" value="false" />
 	  	<view-param name="popup-save" value="false"/>
    	<context name="_showRecord" expr="eval: id"/>
	</action-view>
    
</object-views>