<?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="umr-grid" title="Unique Mandate References" model="com.axelor.apps.account.db.Umr">
        <field name="umrNumber"/>
        <field name="debtorName"/>
        <field name="debtorAddress" form-view="address-form" grid-view="address-grid"/>
        <field name="creationDate"/>
        <field name="mandateSignatureDate"/>
        <field name="mandateSignatureCity" form-view="city-form" grid-view="city-grid"/>
    </grid>
    
    <form name="umr-form" title="Unique Mandate References" model="com.axelor.apps.account.db.Umr"  
    	onNew="action-umr-record-new">
       <panel name="mainPanel" >
	       	<field name="umrNumber"/>
	        <field name="debtorName"/>
	        <field name="debtorAddress" form-view="address-form" grid-view="address-grid"/>
	        <field name="creationDate"/>
	        <field name="mandateSignatureDate"/>
	        <field name="mandateSignatureCity" form-view="city-form" grid-view="city-grid"/>
       </panel>
    </form>
    
    <action-record name="action-umr-record-new" model="com.axelor.apps.account.db.Umr">
    	<field name="debtorName"  expr="eval: __parent__?.name" if="__parent__?._model == 'com.axelor.apps.base.db.Partner'"/>
    	<field name="debtorAddress"  expr="call: com.axelor.apps.base.service.PartnerService:getInvoicingAddress(__repo__(Partner).find(__parent__.id))" if="__parent__?._model == 'com.axelor.apps.base.db.Partner'"/>
    	<field name="creationDate"  expr="eval: __config__.app.getTodayDate()"/>
    	<field name="mandateSignatureDate"  expr="eval: __config__.app.getTodayDate()"/>
<!--     	<field name="mandateSignatureCommune"  expr="eval: com.axelor.apps.base.db.Commune.findByInseeCode(&quot;86194&quot;)"/> -->
        <field if="__parent__?._model == 'com.axelor.apps.base.db.Partner'" name="umrNumber" expr="call: com.axelor.apps.account.service.umr.UmrNumberService:getUmrNumber(__repo__(Partner).find(__parent__.id))" />
    </action-record>
    
</object-views>
