<?xml version="1.0" encoding="UTF-8"?>
<ns1:model xmlns:e="leaf.service.exception" xmlns:ns2="leaf.database.local.oracle" xmlns:ns1="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="ugh" baseTable="EXP_USER_GROUP_HEADERS">
    <ns1:fields>
        <ns1:field name="expense_user_group_id" databaseType="NUMBER" datatype="java.lang.Double"/>
        <ns1:field name="company_id" databaseType="NUMBER" datatype="java.lang.Double"/>
        <ns1:field name="expense_user_group_code" databaseType="VARCHAR2" datatype="java.lang.String" prompt="EXP_EMPLOYEE_GROUP.EXPENSE_USER_GROUP_CODE"/>
        <ns1:field name="description_id" databaseType="NUMBER" datatype="java.lang.Long" multiLanguage="true" multiLanguageDescField="description"/>
        <ns1:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" forInsert="false" forUpdate="false" prompt="EXP_EMPLOYEE_GROUP.EXPENSE_USER_GROUP_DESC"/>
        <ns1:field name="responsibility_center_id" databaseType="NUMBER" datatype="java.lang.Double"/>
        <ns1:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" prompt="EXP_ORG_UNIT_TYPES.ENABLED_FLAG"/>
    </ns1:fields>
    <ns1:primary-key>
        <ns1:pk-field name="expense_user_group_id"/>
    </ns1:primary-key>
    <ns1:relations>
        <ns1:relation name="fa" joinType="left outer" refModel="fnd.EXP1060.fnd_responsibility_centers_select">
            <ns1:reference foreignField="responsibility_center_id" localField="responsibility_center_id"/>
        </ns1:relation>
    </ns1:relations>
    <ns1:query-fields>
        <ns1:query-field field="expense_user_group_code" queryOperator="like"/>
        <ns1:query-field field="description" queryExpression="exists (select 1 from fnd_descriptions fd where ugh.description_id=fd.description_id and fd.description_text like ${@description} and fd.language = ${/session/@lang})"/>
    </ns1:query-fields>
    <ns1:data-filters>
        <ns1:data-filter name="company_id" expression="ugh.company_id=${/session/@company_id}"/>
    </ns1:data-filters>
    <ns1:features>
        <ns2:sequence-pk/>
        <f:standard-who/>
        <f:multi-language-storage/>
    </ns1:features>
    <ns1:ref-fields>
        <ns1:ref-field name="responsibility_center_name_id" relationName="fa" sourceField="responsibility_center_name_id"/>
    </ns1:ref-fields>
    <e:exception-descriptor-config>
        <e:exception-descriptor exception="java.sql.SQLException" handleClass="leaf.database.SQLExceptionDescriptor">
            <e:error-message code="1" message="EXP_USERS_GROUP_HEADER.DISTINCT"/>
        </e:exception-descriptor>
    </e:exception-descriptor-config>
</ns1:model>
