<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:ns2="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="fch" extend="fnd.fnd_company_hierarchy_detail" extendMode="reference">
    <bm:fields>
        <bm:field name="company_hierarchy_id"/>
        <bm:field name="company_id"/>
        <bm:field name="parent_company_id"/>
        <bm:field name="enabled_flag" prompt="HAP_ENABLED_FLAG"/>
        <bm:field name="company_code_display" databaseType="VARCHAR" datatype="java.lang.String" expression="(fc.company_code || &apos;-&apos; || fc.company_short_name)" prompt="FND_COMPANIES.COMPANY_CODE"/>
        <bm:field name="company_type_display" databaseType="VARCHAR" datatype="java.lang.String" expression="(select code_value_name from sys_service_lookup_v where code = &apos;COMPANY_TYPE&apos; and code_value = to_char(fc.company_type) and language=${/session/@lang})" prompt="FND_COMPANIES.COMPANY_TYPE"/>
    </bm:fields>
    <bm:primary-key>
        <bm:pk-field name="company_hierarchy_id"/>
    </bm:primary-key>
    <bm:relations>
        <bm:relation name="fc" joinType="INNER" refModel="fnd.fnd_companies">
            <bm:reference foreignField="company_id" localField="company_id"/>
        </bm:relation>
    </bm:relations>
    <bm:query-fields>
        <bm:query-field name="parent_company_id" queryExpression="fch.parent_company_id = ${/parameter/@parent_company_id}"/>
    </bm:query-fields>
    <bm:features>
        <ns2:sequence-pk/>
        <f:standard-who/>
        <f:multi-language-storage/>
    </bm:features>
    <bm:ref-fields>
        <bm:ref-field name="set_of_books_id" relationName="fc" sourceField="set_of_books_id"/>
        <bm:ref-field name="company_code" relationName="fc" sourceField="company_code"/>
        <bm:ref-field name="company_short_name" prompt="FND_COMPANIES.COMPANY_SHORT_NAME" relationName="fc" sourceField="company_short_name"/>
    </bm:ref-fields>
</bm:model>
