<?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">
	
	<form name="app-base-config-form" title="App base" model="com.axelor.apps.base.db.AppBase" width="large" canDelete="false" canNew="false">
		<toolbar>
		    <button name="newBtn" title="New" hidden="true"/>
		    <button name="deleteBtn" title="Delete" hidden="true"/>
		    <button name="backBtn" title="Back" hidden="true"/>
		    <button name="copyBtn" title="Copy" hidden="true"/>
		    <button name="searchBtn" title="Search" hidden="true"/>
		    <button name="exportObjectsBtn" title="Export Object" onClick="action-base-general-export-objects"/>
		    <button name="remindTimesheetsBtn" title="Timesheets Reminder" onClick="action-method-general-remind-timesheet"/>
		</toolbar>
		<panel name="todayPanel" if="com.axelor.app.AppSettings.get().get('application.mode') != 'prod'">
			<field name="today"/>
		</panel>
		<panel-tabs name="mainPanelTab">
			<panel name="configurationPanel" title="Configuration" colSpan="12">
    	    	<field name="defaultPartnerLanguage" />
    		    <field name="enableTradingNamesManagement" widget="boolean-switch"/>
    	    	<field name="activateSendingEmail" widget="boolean-switch"/>
    	    	<field name="emailAccountByUser" widget="boolean-switch"/>
    	    	<field name="productInAtiSelect"/>
    	    	<field name="nbDecimalDigitForUnitPrice"/>
    	    	<field name="computeMethodDiscountSelect"/>
    	    	<field name="timeLoggingPreferenceSelect"/>
    	    	<field name="dailyWorkHours"/>
    	    	<field name="unitDays" form-view="unit-form" grid-view="unit-grid"/>
    	    	<field name="unitHours" form-view="unit-form" grid-view="unit-grid"/>
    	    	<field name="unitMinutes" form-view="unit-form" grid-view="unit-grid"/>
    	    	<field name="teamManagement" widget="boolean-switch"/>
    	    	<panel name="productBarCodePanel" title="Product BarCode">
    	    		<field name="activateBarCodeGeneration" widget="Boolean-switch"/>
    	    		<field name="editProductBarcodeType" showIf="activateBarCodeGeneration==true" widget="boolean-switch"/>
       			 	<field name="barcodeTypeConfig" showIf="activateBarCodeGeneration==true" requiredIf="activateBarCodeGeneration &amp;&amp; !editProductBarcodeType"/>
			    </panel>
                <field name="generatePartnerSequence" widget="boolean-switch"/>
				<field name="generateProductSequence" widget="boolean-switch"/>
				<field name="manageProductVariants" widget="boolean-switch"/>
				<field name="manageMultiBanks" widget="boolean-switch"/>
				<field name="enterpriseCommunication" widget="boolean-switch"/>
				<field name="enableCalendars" widget="boolean-switch"/>
				<field name="document" widget="boolean-switch"/>
                <field name="passwordChangedTemplate"/>
                <field name="limitNumberTasksGenerated"/>
                <field name="enableMultiCompany" widget="boolean-switch" onChange="action-base-validate-multi-company-boolean"/>
                <field name="storeStreets" widget="boolean-switch" />
			</panel>
		    <panel name="interfacesPanel" title="Interfaces"  colSpan="12">
				<panel name="mapPanel" title="Mapping"  colSpan="12">
					<field name="mapApiSelect"/>
					<button name="checkMapApiBtn" title="Test mapping service connection"   onClick="save,com.axelor.apps.base.web.AppBaseController:checkMapApi" hideIf="mapApiSelect == 2"/>
					<field name="googleMapsApiKey" widget="password" hideIf="mapApiSelect == 2"/>
					<spacer hidden="true" colSpan="6" />
					<field name="osmRoutingServiceApiSelect" hideIf="mapApiSelect == 1" requiredIf="mapApiSelect == 2" help="Use YOUR navigation (http://www.yournavigation.org/api/1.0/gosmore.php) or OSRM (https://router.project-osrm.org/route/v1/driving) Open source routing APIs to get routing information based upon a given start/end location."/>
				</panel>
				<panel name="qasPanel" title="Addresses validation"  colSpan="12">
					<field name="qasWsdlUrl"/>
					<button name="checkQasWsdlBtn" title="Test connection to QAS webservice"   onClick="com.axelor.apps.base.web.AddressController:check"/>
					<field name="hasQasValidation" widget="boolean-switch"/>
				</panel>
				<panel name="wsPanel" title="Webservices"  colSpan="12">
					<field name="currencyWsURL" colSpan="12"/>
				</panel>
		    </panel>
		    <panel name="currencyConversionPanel" title="Currency conversion" colSpan="12">
				<button name="updateCurrencyConversionBtn" title="Update &amp; Historize conversion rate"  onClick="save,action-base-method-update-currency-conversion"/>
				<field name="currencyConversionLineList" colSpan="12" grid-view="currency-conversion-line-grid" form-view="currency-conversion-line-form"/>
			</panel>
		</panel-tabs>
		<panel-mail name="mailPanel">
			<mail-messages limit="4"/>
			<mail-followers/>
		</panel-mail>
	</form>
	
	<!-- ACTION METHOD -->

	<action-method name="action-base-method-update-currency-conversion">
		<call class="com.axelor.apps.base.web.AppBaseController" method="updateCurrencyConversion" />
	</action-method>
	
	<action-method name="action-base-general-export-objects">
	    <call method="exportObjects" class="com.axelor.apps.base.web.AppBaseController"/>
	</action-method>
	
	<action-method name="action-method-general-remind-timesheet">
		<call class="com.axelor.apps.base.web.MailBatchController" method="remindTimesheetGeneral"/>
	</action-method>
	
	<!-- ACTION VALIDATE -->
	<action-validate name="action-base-validate-multi-company-boolean">
		<error if="!enableMultiCompany &amp;&amp; __repo__(Company).all().count() &gt; 1" action="action-base-record-set-enable-multi-company" message="You can not turn-off this configuration because more than one company is configurated in the system."/>
	</action-validate>
	
	<!-- ACTION RECORD -->
	<action-record name="action-base-record-set-enable-multi-company" model="com.axelor.apps.base.db.AppBase">
  		<field if="!enableMultiCompany &amp;&amp; __repo__(Company).all().count() &gt; 1" name="enableMultiCompany" expr="eval: true"/>
	</action-record>
</object-views>
