<?xml version="1.0" encoding="UTF-8"?>
<domain-models xmlns="http://axelor.com/xml/ns/domain-models"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://axelor.com/xml/ns/domain-models http://axelor.com/xml/ns/domain-models/domain-models_5.2.xsd">

    <module name="account" package="com.axelor.apps.account.db"/>

    <entity name="Account" lang="java" cacheable="true">

        <string name="name" title="Name" required="true"/>
        <string name="code" title="Code" required="true" hashKey="true"/>
        <many-to-one name="parentAccount" ref="Account" title="Parent Account" massUpdate="true"/>
        <many-to-one name="accountType" ref="AccountType" massUpdate="true" title="Account Type"/>
        <boolean name="reconcileOk" massUpdate="true" title="Reconcilable"/>
        <many-to-one name="company" ref="com.axelor.apps.base.db.Company" title="Company"/>
        <many-to-many name="compatibleAccountSet" ref="com.axelor.apps.account.db.Account" title="Compatible Accounts"/>
        <boolean name="useForPartnerBalance" title="Use for partner balance" massUpdate="true"/>
        <string name="label" namecolumn="true" search="code,name,company" title="Full name">
            <![CDATA[
	    if(company != null)
	    	return code+"_"+ company.getCode() + " - " + name;    
    	else
    		return code+" - " + name;
	    ]]>
        </string>
        <boolean name="analyticDistributionRequiredOnInvoiceLines" title="Analytic distribution required on invoice lines" massUpdate="true"/>
        <boolean name="analyticDistributionRequiredOnMoveLines" title="Analytic distribution required on move lines" massUpdate="true"/>
        <boolean name="analyticDistributionAuthorized" title="Analytic distribution authorized" massUpdate="true"/>
        <boolean name="isTaxAuthorizedOnMoveLine" title="Tax authorized on move line" massUpdate="true"/>
    	<boolean name="isTaxRequiredOnMoveLine" title="Tax required on move line" massUpdate="true"/>
   	   	<many-to-many name="batchSet" ref="com.axelor.apps.base.db.Batch" title="Batchs"/>


        <track>
      		<field name="name"/>
      		<field name="code"/>
      		<field name="parentAccount"/>
      		<field name="accountType"/>
      		<field name="reconcileOk"/>
      		<field name="company"/>
      		<field name="useForPartnerBalance"/>
      		<field name="analyticDistributionRequiredOnInvoiceLines"/>
      		<field name="analyticDistributionRequiredOnMoveLines"/>
      		<field name="analyticDistributionAuthorized"/>
      		<field name="isTaxAuthorizedOnMoveLine"/>
      		<field name="isTaxRequiredOnMoveLine"/>
      	</track>

    </entity>
</domain-models>
