<?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="sale-order-form" title="Sale order" model="com.axelor.apps.sale.db.SaleOrder" id="business-project-sale-order-form" extension="true">
		<extend target="/">
			<attribute name="onLoad" value="action-group-business-project-saleorder-onload"/>
		</extend>
	</form>
	
	<form name="sale-order-template-form" title="Template" model="com.axelor.apps.sale.db.SaleOrder" id="business-project-sale-order-template-form" extension="true">
		<extend target="/">
			<attribute name="onNew" value="action-group-sale-saleorder-onnew,action-saleorder-record-template,action-sale-order-method-create-template"/>
		</extend>
	</form>
	
	<action-group name="action-group-business-project-saleorder-onload">
		<action name="action-group-supplychain-saleorder-onload"/>
        <action name="action-sale-order-attrs-project"/>
	</action-group>

	<action-attrs name="action-sale-order-attrs-project">
		<attribute for="$genProjTypePerOrderLine" name="value" if="eval: __config__.app.getApp('business-project').getGeneratedElementTypeSelect() == 1" expr="eval: com.axelor.apps.project.db.GenProjTypePerOrderLine.TASK_BY_LINE"/>
		<attribute for="$genProjTypePerOrderLine" name="value" if="eval: __config__.app.getApp('business-project').getGeneratedElementTypeSelect() == 2" expr="eval: com.axelor.apps.project.db.GenProjTypePerOrderLine.PHASE_BY_LINE"/>
		<attribute for="$genProjTypePerOrderLine" name="readonly" expr="eval: __config__.app.getApp('business-project').getGeneratedElementTypeSelect() != 3"/>
	</action-attrs>

    <action-method name="action-business-project-sale-order-method-generate-invoicing-project">
    	<call class="com.axelor.apps.businessproject.web.SaleOrderProjectController" method="generateInvoicingProject"/>
    </action-method>
    
    <action-condition name="action-business-project-sale-order-condition-invoicing">
    	<check error="A deadline is required" field="deadline" if="!deadline"/>
    </action-condition>

	<action-method name="action-business-project-method-generate-project">
		<call class="com.axelor.apps.businessproject.web.SaleOrderProjectController" method="generateProject"/>
	</action-method>

	<action-method name="action-business-project-method-fill-project">
		<call class="com.axelor.apps.businessproject.web.SaleOrderProjectController" method="fillProject"/>
	</action-method>

    <action-method name="action-business-project-sale-order-method-update-lines">
    	<call class="com.axelor.apps.businessproject.web.SaleOrderProjectController" method="updateLines"/>
    </action-method>

</object-views>