<commit_before><?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.0.xsd">

	<grid name="bank-details-grid" title="Bank details" model="com.axelor.apps.base.db.BankDetails">
		<toolbar>
			<button name="checkDuplicate" title="Check Duplicate" onClick="action-general-check-duplicate-records"/>
		</toolbar>
		<hilite if="!active" background="warning"/>
		<field name="ownerName"/>
		<field name="bankAddress"/>
		<field name="iban"/>
		<field name="bank.code"/>
        <field name="active"/>
	</grid>

	<form onSave="action-validate-bank-details-bbanKey" onNew="action-group-account-bank-details-form-onnew" name="bank-details-form" title="Bank details"
		  onLoad="action-group-account-bank-details-form-onload" model="com.axelor.apps.base.db.BankDetails" width="large">
		<panel name="owner" title="Owner">
			<field name="partner" onChange="action-set-owner-name" domain="self.isContact = false" form-view="partner-form" grid-view="partner-grid" />
			<field name="ownerName" />
		</panel>
        <panel>
			<field name="label"/>
			<field name="currency"/>
            <field name="code" x-bind="{{code|uppercase}}" readonly="true" />
		</panel>
		<panel sidebar="true">
			<field name="active" widget="Boolean-switch"/>
		</panel>
		<panel name="iban" title="IBAN / BBAN">
			<field name="bank.bankDetailsTypeSelect" readonly="true"/>
			<panel>
				<field name="iban" readonlyIf="bank==null" onChange="action-group-account-bankdetails-iban-onchange" colSpan="12" />
				<static name="invalidIbanText" hidden="true" colSpan="12"><![CDATA[<span class='label label-warning'>Invalid IBAN</span>]]></static>
			</panel>
			<field name="bank" canNew="true" form-view="bank-form" onChange="action-group-bank-details-bank-onchange"/>
			<field name="bankAddress" showIf="bank" grid-view="bank-address-grid"
				   onSelect="action-attrs-account-bankdetails-bank-set-address-domain"
				   canNew="true" form-view="bank-address-form"/>
			<field name="ibanBic" readonly="true" x-bind="{{iban + ' ' + bank.code}}"/>
		</panel>
		<panel name="bban" title="BBAN" hideIf="bank.country.alpha2Code != 'FR'">
			<field name="bankCode" colSpan="3" />
			<field name="sortCode" colSpan="3"/>
			<field name="accountNbr" colSpan="3"/>
			<field name="bbanKey" colSpan="3"/>
			<field name="bank.country.alpha2Code" hidden="true"/>
		</panel>
	</form>
	
	<action-group name="action-group-account-bankdetails-iban-onchange">
		<action name="action-method_bank-details-validate-iban" />
	</action-group>

	<action-group name="action-group-bank-details-bank-onchange">
		<action name="action-attrs-account-bankdetails-bank-empty-address"/>
	</action-group>

	<action-group name="action-group-account-bank-details-form-onnew">
		<action name="action-method_bank-details-validate-iban"/>
		<action name="action-set-default-partner"/>
		<action name="action-set-default-bank"/>
        <action name="action-bank-details-attrs-code"/>
	</action-group>

	<action-group name="action-group-account-bank-details-form-onload">
		<action name="action-method_bank-details-validate-iban"/>
        <action name="action-bank-details-attrs-code"/>
	</action-group>

	<action-method name="action-method_bank-details-validate-iban">
		<call class="com.axelor.apps.base.web.BankDetailsController" method="validateIban" />
	</action-method>

	<action-record name="action-set-owner-name" model="com.axelor.apps.base.db.BankDetails">
		<field name="ownerName" expr="eval:partner != null ? ((partner.name != null ? partner.name : '') + ' ' + (partner.firstName != null ? partner.firstName: ''))  : ''" />
	</action-record>

	<action-record name="action-set-default-partner" model="com.axelor.apps.base.db.BankDetails">
		<field name="partner" expr="eval:_parent" if="_parent != null &amp;&amp; _parent.get('_model') == 'com.axelor.apps.base.db.Partner'" />
		<field name="ownerName" if="_parent != null &amp;&amp; _parent.get('_model') == 'com.axelor.apps.base.db.Partner'"
			expr="eval:_parent != null ? (_parent.name != null ? _parent.name : '') + ' ' + (_parent.firstName != null ? _parent.firstName : '') : ''" />
	</action-record>

	<action-record name="action-set-default-bank" model="com.axelor.apps.base.db.BankDetails">
		<field expr="eval: __parent__.ebicsBank?.bank" name="bank" if="__parent__?._model == 'com.axelor.apps.bankpayment.db.EbicsPartner'"/>
	</action-record>

	<action-validate name="action-validate-bank-details-bbanKey">
		<error message="Incorrect BBAN Key"
			if="bank.bankDetailsTypeSelect == 1 &amp;&amp; ( 97 - ( ( 89 * Long.parseLong( bankCode ) + 15 * Long.parseLong( sortCode ) + 3 * Long.parseLong( accountNbr.replaceAll('[ajAJ]','1').replaceAll('[bksBKS]','2').replaceAll('[cltCLT]','3').replaceAll('[dmuDMU]','4').replaceAll('[envENV]','5').replaceAll('[fowFOW]','6').replaceAll('[gpxGPX]','7').replaceAll('[hqyHQY]','8').replaceAll('[irzIRZ]','9') ) ) % 97 )  != Long.parseLong( bbanKey ))" />
	</action-validate>

	<action-attrs name="action-attrs-account-bankdetails-bank-empty-address">
		<attribute for="bankAddress" name="value" expr="eval: null"/>
	</action-attrs>

	<action-attrs name="action-attrs-account-bankdetails-bank-set-address-domain">
		<attribute for="bankAddress" name="domain" expr="eval: &quot; self.id IN (0) &quot;"/>
		<attribute for="bankAddress" name="domain"
                   if="bank &amp;&amp; !bank.bankAddressList.isEmpty()"
				   expr="eval: &quot; self.id IN (${bank.bankAddressList.collect{it.id}.join(',')}) &quot;" />
	</action-attrs>

    <action-attrs name="action-bank-details-attrs-code">
        <attribute name="readonly" for="code" expr="eval: ![Company, EbicsPartner].contains(__parent__.getContextClass())" if="__parent__"/>
    </action-attrs>

</object-views><commit_msg>RM11653: show bank details code only from company and Ebics partner.<commit_after><?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.0.xsd">

	<grid name="bank-details-grid" title="Bank details" model="com.axelor.apps.base.db.BankDetails">
		<toolbar>
			<button name="checkDuplicate" title="Check Duplicate" onClick="action-general-check-duplicate-records"/>
		</toolbar>
		<hilite if="!active" background="warning"/>
		<field name="ownerName"/>
		<field name="bankAddress"/>
		<field name="iban"/>
		<field name="bank.code"/>
        <field name="active"/>
	</grid>

	<form onSave="action-validate-bank-details-bbanKey" onNew="action-group-account-bank-details-form-onnew" name="bank-details-form" title="Bank details"
		  onLoad="action-group-account-bank-details-form-onload" model="com.axelor.apps.base.db.BankDetails" width="large">
		<panel name="owner" title="Owner">
			<field name="partner" onChange="action-set-owner-name" domain="self.isContact = false" form-view="partner-form" grid-view="partner-grid" />
			<field name="ownerName" />
		</panel>
        <panel>
			<field name="label"/>
			<field name="currency"/>
            <field name="code" x-bind="{{code|uppercase}}" hidden="true" />
		</panel>
		<panel sidebar="true">
			<field name="active" widget="Boolean-switch"/>
		</panel>
		<panel name="iban" title="IBAN / BBAN">
			<field name="bank.bankDetailsTypeSelect" readonly="true"/>
			<panel>
				<field name="iban" readonlyIf="bank==null" onChange="action-group-account-bankdetails-iban-onchange" colSpan="12" />
				<static name="invalidIbanText" hidden="true" colSpan="12"><![CDATA[<span class='label label-warning'>Invalid IBAN</span>]]></static>
			</panel>
			<field name="bank" canNew="true" form-view="bank-form" onChange="action-group-bank-details-bank-onchange"/>
			<field name="bankAddress" showIf="bank" grid-view="bank-address-grid"
				   onSelect="action-attrs-account-bankdetails-bank-set-address-domain"
				   canNew="true" form-view="bank-address-form"/>
			<field name="ibanBic" readonly="true" x-bind="{{iban + ' ' + bank.code}}"/>
		</panel>
		<panel name="bban" title="BBAN" hideIf="bank.country.alpha2Code != 'FR'">
			<field name="bankCode" colSpan="3" />
			<field name="sortCode" colSpan="3"/>
			<field name="accountNbr" colSpan="3"/>
			<field name="bbanKey" colSpan="3"/>
			<field name="bank.country.alpha2Code" hidden="true"/>
		</panel>
	</form>
	
	<action-group name="action-group-account-bankdetails-iban-onchange">
		<action name="action-method_bank-details-validate-iban" />
	</action-group>

	<action-group name="action-group-bank-details-bank-onchange">
		<action name="action-attrs-account-bankdetails-bank-empty-address"/>
	</action-group>

	<action-group name="action-group-account-bank-details-form-onnew">
		<action name="action-method_bank-details-validate-iban"/>
		<action name="action-set-default-partner"/>
		<action name="action-set-default-bank"/>
        <action name="action-bank-details-attrs-code"/>
	</action-group>

	<action-group name="action-group-account-bank-details-form-onload">
		<action name="action-method_bank-details-validate-iban"/>
        <action name="action-bank-details-attrs-code"/>
	</action-group>

	<action-method name="action-method_bank-details-validate-iban">
		<call class="com.axelor.apps.base.web.BankDetailsController" method="validateIban" />
	</action-method>

	<action-record name="action-set-owner-name" model="com.axelor.apps.base.db.BankDetails">
		<field name="ownerName" expr="eval:partner != null ? ((partner.name != null ? partner.name : '') + ' ' + (partner.firstName != null ? partner.firstName: ''))  : ''" />
	</action-record>

	<action-record name="action-set-default-partner" model="com.axelor.apps.base.db.BankDetails">
		<field name="partner" expr="eval:_parent" if="_parent != null &amp;&amp; _parent.get('_model') == 'com.axelor.apps.base.db.Partner'" />
		<field name="ownerName" if="_parent != null &amp;&amp; _parent.get('_model') == 'com.axelor.apps.base.db.Partner'"
			expr="eval:_parent != null ? (_parent.name != null ? _parent.name : '') + ' ' + (_parent.firstName != null ? _parent.firstName : '') : ''" />
	</action-record>

	<action-record name="action-set-default-bank" model="com.axelor.apps.base.db.BankDetails">
		<field expr="eval: __parent__.ebicsBank?.bank" name="bank" if="__parent__?._model == 'com.axelor.apps.bankpayment.db.EbicsPartner'"/>
	</action-record>

	<action-validate name="action-validate-bank-details-bbanKey">
		<error message="Incorrect BBAN Key"
			if="bank.bankDetailsTypeSelect == 1 &amp;&amp; ( 97 - ( ( 89 * Long.parseLong( bankCode ) + 15 * Long.parseLong( sortCode ) + 3 * Long.parseLong( accountNbr.replaceAll('[ajAJ]','1').replaceAll('[bksBKS]','2').replaceAll('[cltCLT]','3').replaceAll('[dmuDMU]','4').replaceAll('[envENV]','5').replaceAll('[fowFOW]','6').replaceAll('[gpxGPX]','7').replaceAll('[hqyHQY]','8').replaceAll('[irzIRZ]','9') ) ) % 97 )  != Long.parseLong( bbanKey ))" />
	</action-validate>

	<action-attrs name="action-attrs-account-bankdetails-bank-empty-address">
		<attribute for="bankAddress" name="value" expr="eval: null"/>
	</action-attrs>

	<action-attrs name="action-attrs-account-bankdetails-bank-set-address-domain">
		<attribute for="bankAddress" name="domain" expr="eval: &quot; self.id IN (0) &quot;"/>
		<attribute for="bankAddress" name="domain"
                   if="bank &amp;&amp; !bank.bankAddressList.isEmpty()"
				   expr="eval: &quot; self.id IN (${bank.bankAddressList.collect{it.id}.join(',')}) &quot;" />
	</action-attrs>

    <action-attrs name="action-bank-details-attrs-code">
        <attribute name="hidden" for="code" expr="eval: ![Company, EbicsPartner].contains(__parent__.getContextClass())" if="__parent__"/>
    </action-attrs>

</object-views>
{'fraction_non_alphanumeric': 0.20449795167628124, 'fraction_numerical': 0.007106429228325391, 'mean_word_length': 4.951243781094528, 'pattern_counts': {'":': 0, '<': 185, '<?xml version=': 2, '>': 185, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 12}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5390616', 'n_tokens_mistral': 4333, 'n_tokens_neox': 4027, 'n_words': 579}