<?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="purchase-order-line-purchase-order-grid" title="PO lines" model="com.axelor.apps.purchase.db.PurchaseOrderLine">
    	<hilite color="default" strong="true" if="isTitleLine == true"/>
		<hilite color="danger" if="receiptState == 1"/>
		<hilite color="warning" if="receiptState == 2"/>
		<hilite color="success" if="receiptState == 3"/>
		<field name="sequence" if="__config__.app.getApp('purchase')?.isDisplayPurchaseOrderLineNumber" width="51"/>
		<field name="receiptState" hidden="true" if="__config__.app.isApp('supplychain')" />
    	<field name="productName"/>
    	<field name="productCode"/>
        <field name="qty" aggregate="sum"/>
        <field name="unit" form-view="unit-form" grid-view="unit-grid"/>
        <field name="priceDiscounted" title="Unit price W.T." x-scale="2"/>
        <field name="inTaxPrice" x-scale="2"/>
        <field name="exTaxTotal" aggregate="sum"/>
	    <field name="inTaxTotal" aggregate="sum"/>
        <field name="isTitleLine" hidden="true"/>
	<field name="desiredDelivDate"/>
    	<field name="estimatedDelivDate"/>
    </grid>
    
    <grid name="purchase-order-line-invoicing-project-grid" title="PO lines" model="com.axelor.apps.purchase.db.PurchaseOrderLine" orderBy="-purchaseOrder.orderDate" canMove="true">
       	<field name="purchaseOrder" form-view="purchase-order-form" grid-view="purchase-order-grid"/>
    	<field name="supplierPartner" form-view="partner-form" grid-view="partner-grid"/>
    	<field name="productName"/>
        <field name="qty" aggregate="sum"/>
        <field name="unit" form-view="unit-form" grid-view="unit-grid"/>
        <field name="priceDiscounted" title="Unit price W.T."/>
        <field name="inTaxPrice" x-scale="2"/>
        <field name="exTaxTotal" aggregate="sum"/>
	    <field name="inTaxTotal" aggregate="sum"/>
        <field name="purchaseOrder.currency"/>
		<field name="toInvoice"/>
        <field name="invoiced"/>
    </grid>

	<grid model="com.axelor.apps.purchase.db.PurchaseOrderLine" title="PO lines" name="purchase-order-line-grid" canNew="false" canDelete="false" canEdit="false">
		<field name="purchaseOrder.purchaseOrderSeq" width="120"/>
		<field name="purchaseOrder.supplierPartner" form-view="partner-form" grid-view="partner-grid"/>
		<field name="productCode"/>
		<field name="product.code" title="Code" width="120"/>
		<field name="productName"/>
		<field name="qty" aggregate="sum"/>
		<field name="unit" form-view="unit-form" grid-view="unit-grid"/>
		<field name="priceDiscounted" title="Unit price W.T." x-scale="2"/>
		<field name="inTaxPrice" x-scale="2"/>
		<field name="purchaseOrder.currency"/>
		<field name="purchaseOrder.buyerUser"/>
		<field name="desiredDelivDate"/>
		<field name="estimatedDelivDate"/>
	</grid>
  
   <grid name="purchase-order-line-menu-grid" title="PO lines" model="com.axelor.apps.purchase.db.PurchaseOrderLine" canNew="false" canDelete="false" canEdit="false">
      <field name="purchaseOrder"/>
      <field name="purchaseOrder.company"/>
      <field name="purchaseOrder.stockLocation" if="__config__.app.isApp('supplychain')"/>
      <field name="purchaseOrder.clientPartner"/>
      <field name="product.code"/>
      <field name="productName"/>
      <field name="qty" aggregate="sum"/>
      <field name="receivedQty" aggregate="sum"/>
      <field name="unit" form-view="unit-form" grid-view="unit-grid"/>
      <field name="price" x-scale="2"/>
      <field name="inTaxPrice" x-scale="2"/>
	  <field name="desiredDelivDate"/>
	  <field name="estimatedDelivDate"/>
  </grid>

    <form name="purchase-order-line-project-form" title="PO line" model="com.axelor.apps.purchase.db.PurchaseOrderLine" onLoad="action-group-purchase-purchase-orderline-onload" readonlyIf="true" canEdit="false">
        <panel-include view="purchase-order-line-form"/>
    </form>

	<form name="purchase-order-line-form" title="PO line" model="com.axelor.apps.purchase.db.PurchaseOrderLine"
		  onNew="action-group-purchase-purchase-orderline-onnew"
		  onLoad="action-group-purchase-purchase-orderline-onload" width="large">

		<panel name="namePanel" hideIf="!isTitleLine">
			<field name="productName" colSpan="10" title="Title"/>
			<field name="isTitleLine" colSpan="2" onChange="action-purchase-order-line-method-empty-line" widget="boolean-switch"/>
		</panel>

		<panel-tabs name="mainPanelTab" hideIf="isTitleLine">
			<panel name="informationsPanel" title="Information">
				<field name="receiptState" showTitle="false" colSpan="3" showIf="receiptState > 0" if-module="axelor-supplychain" if="__config__.app.isApp('supplychain')">
					<viewer><![CDATA[
	                    <h4>
	                        <span class="label label-important" ng-show="record.receiptState == 1" x-translate>Not received</span>
	                        <span class="label label-warning" ng-show="record.receiptState == 2" x-translate>Partially received</span>
	                        <span class="label label-success" ng-show="record.receiptState == 3" x-translate>Received</span>
	                    </h4>
					]]></viewer>
				</field>
       			<spacer name="receiptStateSpacer"  if="__config__.app.isApp('supplychain')"/>
				<field name="product"  canEdit="false" onChange="action-group-purchase-purchase-orderline-product-onchange"
				  onSelect="action-purchase-order-line-attrs-product-domain" form-view="product-form" grid-view="product-grid"/>
				<field name="$isFilterOnSupplier" type="boolean" title="Filter on supplier" widget="boolean-switch" colSpan="2" if="__config__.app.getApp('purchase').getManageSupplierCatalog()"/>
				<field name="isTitleLine" colSpan="2" colOffset="2" onChange="action-purchase-order-line-method-empty-line" widget="boolean-switch"/>
				<field name="productCode" colSpan="3"/>
				<field name="productName" colSpan="9"/>
				<panel name="orderDetailsPanel" colSpan="12">
					<field name="qty" onChange="action-group-purchase-purchase-orderline-qty-onchange" colSpan="3" validIf="$qtyValid != false"/>
					<field name="unit" colSpan="3" canEdit="false" form-view="unit-form" grid-view="unit-grid"/>
					<panel name="pricePanel" colSpan="3">
		          		<field name="price" hidden="true" colSpan="12" onChange="action-purchase-order-line-method-onchange-price,action-purchase-order-line-method-compute,action-purchase-order-line-method-compute-analytic-distribution,action-budget-validate-exceed-line-amount">
		            		<hilite color="danger" if=" $number(saleMinPrice) &lt; $number(salePrice)"/>
		          		</field>
		          		<field name="inTaxPrice" hidden="true" colSpan="12" onChange="action-purchase-order-line-method-onchange-intaxprice,action-purchase-order-line-method-compute,action-purchase-order-line-method-compute-analytic-distribution,action-budget-validate-exceed-line-amount">
	            			<hilite color="danger" if=" $number(saleMinPrice) &lt; $number(salePrice)"/>
		          		</field>
		        	</panel>
					<field name="saleMinPrice" colSpan="3" readonly="true"/>
					<label name="minQtyNotRespectedLabel" hidden="true" colSpan="12"/>
					<label name="multipleQtyNotRespectedLabel" hidden="true" colSpan="12"/>
					<field name="$qtyValid" hidden="true" colSpan="12"/>
				</panel>
				<panel name="discountPanel" colSpan="12">
					<field name="discountTypeSelect" colSpan="3" onChange="action-purchase-order-line-method-compute,action-purchase-order-line-attrs-discountamount-title,action-purchase-order-line-method-compute-analytic-distribution,action-budget-validate-exceed-line-amount"/>
					<field name="discountAmount" colSpan="3" onChange="action-purchase-order-line-method-compute,action-purchase-order-line-method-compute-analytic-distribution,action-budget-validate-exceed-line-amount" hideIf="discountTypeSelect == 3"/>
					<field name="priceDiscounted" colSpan="3" readonly="true" hidden="true"/>
				</panel>
				<field name="taxLine" canEdit="false" onChange="action-group-purchase-purchase-orderline-taxline-onchange" domain="self.endDate = null or self.endDate &gt; :__date__" grid-view="tax-line-grid" form-view="tax-line-form"/>
				<field name="exTaxTotal" colSpan="3" readonly="true"/>
				<field name="inTaxTotal" colSpan="3" readonly="true"/>
				<field name="fixedAssets" widget="boolean-switch"/>
				<field name="salePrice" colSpan="3" hidden="true"/>
				<field name="taxEquiv" hidden="true" grid-view="tax-equiv-grid" form-view="tax-equiv-form"/>
				<panel name="descriptionPanel" title="Description" colSpan="12">
					<field name="description" showTitle="false" colSpan="12" widget="html" x-lite="true"/>
				</panel>
			</panel>
			<panel name="supplierRequestsPanel" title="Suppliers requests" if-module="axelor-supplier-management" if="__config__.app.getApp('purchase').getSupplierRequestMgt()" >
				<button name="generateSuppliersRequestsBtn" title="Generate suppliers requests"   onClick="action-group-purchase-purchase-orderline-generate-supplierreq-click"/>
				<field name="supplierPartner" form-view="partner-form" grid-view="partner-grid" onSelect="action-purchase-order-line-set-supplierPartner-domain"/>
				<panel-related name="purchaseOrderSupplierLineListPanel" field="purchaseOrderSupplierLineList" colSpan="12" form-view="purchase-order-supplier-line-form" grid-view="purchase-order-supplier-line-grid"/>
			</panel>
			<panel name="budgetDistributionPanel" title="Budget" if="__config__.app.isApp('budget')" if-module="axelor-supplychain">
				<field name="companyExTaxTotal" title="Total W.T." colSpan="6" if="__config__.app.getApp('budget').getManageMultiBudget()" readonly="true" hidden="false">
					<viewer depends="companyExTaxTotal,$currencySymbol">
						<![CDATA[
							<dd>{{record.companyExTaxTotal}} {{record.$currencySymbol}}</dd>
						]]>
					</viewer>
				</field>
				<field name="budgetDistributionSumAmount" colSpan="6" if="__config__.app.getApp('budget').getManageMultiBudget()" readonly="true"/>
				<field name="budget" if="!__config__.app.getApp('budget').getManageMultiBudget()" domain="self.statusSelect = 2"/>
				<panel-related name="budgetDistributionListPanel" field="budgetDistributionList" form-view="purchase-order-budget-distribution-form" grid-view="purchase-order-budget-distribution-grid" editable="true" colSpan="12" if="__config__.app.getApp('budget').getManageMultiBudget()" onChange="action-budget-validate-exceed-line-amount,action-purchase-order-method-compute-budget-distribution-sum-amount"/>
				<field name="$currencySymbol" hidden="true"/>
			</panel>
			<panel name="deliveryPanel" title="Delivery" hidden="true" colSpan="12">
				<panel name="deliveryDatePanel" colSpan="12">
				<field name="desiredDelivDate"/>
				<field name="estimatedDelivDate"/>
				</panel>
				<panel name="deliveryInformationPanel" colSpan="12">
				<field name="receivedQty" readonly="true"/>
				<field name="supplierComment" colSpan="12"/>
				<panel-dashlet title="In Stock Moves" name="POLineStockMoveLinePanel" action="action-purchase-order-line-view-stock-move-line" colSpan="12"/>
				</panel>
			</panel>
			<panel name="invoicingPanel" title="Invoicing" if-module="axelor-account" if="__config__.app.isApp('supplychain')">
				<field name="amountInvoiced"/>
				<panel-dashlet name="POLineInvoicelinesPanel" action="action-purchase-order-line-view-show-invoice-lines" colSpan="12"/>
			</panel>
			<panel name="projectPanel" if="__config__.app.isApp('business-project') &amp;&amp; __config__.app.getApp('business-project').getProjectPurchaseOrderLines()" title="Business Project" if-module="axelor-business-project">
				<field name="project" domain="self.isBusinessProject = true" title="Business Project" requiredIf="toInvoice" form-view="project-form" grid-view="project-grid" canEdit="false"/>
                <field name="toInvoice" if="__config__.app.isApp('business-project') &amp;&amp; __config__.app.getApp('business-project').getProjectPurchaseOrderLines()" colSpan="3" if-module="axelor-business-project"/>
                <field name="invoiced" showIf="toInvoice &amp;&amp; id &amp;&amp; $readonly()" colSpan="3" showTitle="false">
                <viewer><![CDATA[
					<h4>
                        <span class="label label-success" style="margin: 5px 0 !important; display: inline-table; line-height: initial;" ng-show="record.invoiced" x-translate>Invoiced</span>
                    	<span class="label label-important" style="margin: 5px 0 !important; display: inline-table; line-height: initial;" ng-show="!record.invoiced" x-translate>Not invoiced</span>
                    </h4>
				]]></viewer>
                </field>
			</panel>
			<panel name="analyticDistributionPanel" title="Analytics" if-module="axelor-supplychain" if="__config__.app.isApp('supplychain') &amp;&amp; __config__.app.getApp('account').getManageAnalyticAccounting()" onTabSelect="action-purchase-order-line-attrs-read-only-distribution-lines">
				<field name="analyticDistributionTemplate" grid-view="analytic-distribution-template-grid" form-view="analytic-distribution-template-form" canEdit="false" onChange="action-purchase-order-line-method-create-distribution" onSelect="action-purchase-order-line-attrs-set-domain-analytic-distribution-template"/>
				<panel-related name="analyticMoveLineListPanel" field="analyticMoveLineList" grid-view="analytic-move-line-distribution-grid" form-view="analytic-move-line-distribution-form" colSpan="12"/>
			</panel>
		</panel-tabs>
		<panel name="attrsPanel">
			<field name="attrs" colSpan="12" />
		</panel>
	</form>
	
	<form name="purchase-order-line-menu-form" title="PO line" 
		model="com.axelor.apps.purchase.db.PurchaseOrderLine" 
		onNew="action-group-purchase-purchase-orderline-onnew"
		onLoad="action-group-purchase-purchase-orderline-onload" width="large">
		<panel name="mainPanel" >
			<field name="purchaseOrder.contactPartner"></field>
    		<field name="purchaseOrder.purchaseOrderSeq"></field>
		</panel>
		<panel-include view="purchase-order-line-form"/>
	</form>
	
	<form model="com.axelor.apps.purchase.db.PurchaseOrderLine" title="PO line" name="purchase-order-line-all-form" width="large" canNew="false" canDelete="false" canEdit="false">
		<panel name="mainPanel">
			<field name="purchaseOrder.company" colSpan="3"/>
			<spacer name="purchaseOrderCompanySpacer" colSpan="9"/>
			<field name="purchaseOrder.supplierPartner" grid-view="partner-grid" form-view="partner-form" colSpan="3"/>
			<field name="purchaseOrder.purchaseOrderSeq" grid-view="purchase-order-grid" form-view="purchase-order-form" colSpan="3"/>
			<field name="purchaseOrder.orderDate" colSpan="3"/>
			<field name="purchaseOrder.currency" colSpan="3"/>
		</panel>
		<panel-include view="purchase-order-line-form"/>
	</form>

	<action-method name="action-purchase-order-line-method-empty-line">
		<call class="com.axelor.apps.purchase.web.PurchaseOrderLineController" method="emptyLine"/>
	</action-method>
	
	<action-method name="action-purchase-order-line-method-create-distribution">
		<call class="com.axelor.apps.supplychain.web.PurchaseOrderLineController" method="createAnalyticDistributionWithTemplate"/>
	</action-method>
	
	<action-method name="action-purchase-order-line-method-compute-analytic-distribution" if-module="axelor-supplychain">
		<call class="com.axelor.apps.supplychain.web.PurchaseOrderLineController" method="computeAnalyticDistribution" if="__config__.app.isApp('supplychain')" />
	</action-method>
	
	<action-attrs name="action-purchase-order-line-attrs-read-only-distribution-lines">
		<attribute name="readonly" for="analyticMoveLineList" expr="eval: !__config__.app.isApp('supplychain') || __config__.app.getApp('account').getAnalyticDistributionTypeSelect() != 1"/>
	</action-attrs>
	
	<action-attrs name="action-purchase-order-line-attrs-set-domain-analytic-distribution-template">
		<attribute name="domain" for="analyticDistributionTemplate" expr="eval: &quot; self.company.id = ${_parent?.company.id} &quot;"/>
	</action-attrs>
	
	<action-view name="action-purchase-order-line-view-show-invoice-lines" title="Invoice Lines" model="com.axelor.apps.account.db.InvoiceLine">	
		<view type="grid" name="invoice-line-grid" />
		<view type="form" name="invoice-line-form" />
		<domain>self.purchaseOrderLine.id = :purchaseOrderLineId</domain>
		<context name="purchaseOrderLineId" expr="eval: id" />
	</action-view>
	<!-- ACTION GROUPs -->
	
	<action-group name="action-group-purchase-purchase-orderline-onnew">
		<action name="action-purchase-order-line-attrs-hide-qty-warning-label"/>
		<action name="action-purchase-order-line-attrs-title-project"/>
		<action name="action-purchase-order-line-attrs-scale-and-precision"/>
		<action name="action-purchase-order-line-record-new"/>
		<action name="action-purchase-order-line-record-project"/>
		<action name="action-purchase-order-attrs-hide-ati"/>
		<action name="action-purchase-order-line-attrs-show-priceDiscounted"/>
		<action name="action-purchase-order-line-attrs-hide-qty-warning-label"/>
	</action-group>
	
	<action-group name="action-group-purchase-purchase-orderline-onload">
		<action name="action-purchase-order-line-attrs-readonly-form"/>
		<action name="action-purchase-order-line-method-check-qty"/>
		<action name="action-purchase-order-line-attrs-title-project"/>
		<action name="action-purchase-order-line-attrs-scale-and-precision"/>
		<action name="action-purchase-order-attrs-hide-ati"/>
		<action name="action-purchase-order-line-attrs-show-priceDiscounted"/>
		<action name="action-purchase-order-line-attrs-delivery-panel"/>
		<action name="action-budget-distribution-attrs-budget-amount-available" if="__config__.app.isApp('budget') &amp;&amp; __config__.app.getApp('budget').getManageMultiBudget()"/>
		<action name="action-purchase-order-line-attrs-set-isFilterOnSupplier"/>
	</action-group>
	
	<action-group name="action-group-purchase-purchase-orderline-product-onchange">
		<action name="action-purchase-order-line-attrs-delivery-panel"/>
		<action name="action-purchase-order-line-method-get-product-information"/>
		<action name="action-purchase-order-line-method-compute" if="price != 0"/>
		<action name="action-purchase-order-line-method-check-qty" if="price != 0"/>
		<action name="action-budget-validate-exceed-line-amount"/>
	</action-group>
	
	<action-group name="action-group-purchase-purchase-orderline-qty-onchange">
		<action name="action-purchase-order-line-method-update-product-information"/>
		<action name="action-purchase-order-line-method-compute"/>
		<action name="action-purchase-order-line-method-compute-analytic-distribution" if="__config__.app.isApp('supplychain') &amp;&amp; __config__.app.getApp('account').getManageAnalyticAccounting()"/>
		<action name="action-purchase-order-line-method-check-qty"/>
		<action name="action-budget-validate-exceed-line-amount"/>
	</action-group>
	
	<action-group name="action-group-purchase-purchase-orderline-generate-supplierreq-click">
		<action name="save"/>
		<action name="action-purchase-order-line-method-generate-suppliers-requests"/>
		<action name="save"/>
	</action-group>

	<action-group name="action-group-purchase-purchase-orderline-taxline-onchange">
		<action name="action-purchase-order-line-method-get-tax-equiv"/>
		<action name="action-purchase-order-line-method-convert-tax"/>
		<action name="action-purchase-order-line-method-compute"/>
		<action name="action-purchase-order-line-method-compute-analytic-distribution" if="__config__.app.isApp('supplychain') &amp;&amp; __config__.app.getApp('account').getManageAnalyticAccounting()"/>
		<action name="action-budget-validate-exceed-line-amount"/>
	</action-group>

	<action-attrs name="action-purchase-order-line-attrs-delivery-panel">
		<attribute name="hidden" for="deliveryPanel" expr="eval: product?.productTypeSelect != 'storable'"/>
	</action-attrs>
	
	<action-attrs name="action-purchase-order-attrs-hide-ati">
		<attribute name="hidden" for="exTaxTotal" expr="eval:_parent?.inAti" if="_parent?._model == 'com.axelor.apps.purchase.db.PurchaseOrder'"/>
		<attribute name="hidden" for="inTaxTotal" expr="eval:!_parent?.inAti" if="_parent?._model == 'com.axelor.apps.purchase.db.PurchaseOrder'"/>
		<attribute name="hidden" for="price" expr="eval:_parent?.inAti" if="_parent?._model == 'com.axelor.apps.purchase.db.PurchaseOrder'"/>
		<attribute name="hidden" for="inTaxPrice" expr="eval:!_parent?.inAti" if="_parent?._model == 'com.axelor.apps.purchase.db.PurchaseOrder'"/>
		
		<attribute name="hidden" for="exTaxTotal" expr="eval: purchaseOrder?.inAti" if="purchaseOrder != null &amp;&amp; _parent?._model != 'com.axelor.apps.purchase.db.PurchaseOrder'" />
		<attribute name="hidden" for="inTaxTotal" expr="eval: !purchaseOrder?.inAti" if="purchaseOrder != null &amp;&amp; _parent?._model != 'com.axelor.apps.purchase.db.PurchaseOrder'" />
		<attribute name="hidden" for="price" expr="eval: purchaseOrder?.inAti" if="purchaseOrder != null &amp;&amp; _parent?._model != 'com.axelor.apps.purchase.db.PurchaseOrder'" />
		<attribute name="hidden" for="inTaxPrice" expr="eval: !purchaseOrder?.inAti" if="purchaseOrder != null &amp;&amp; _parent?._model != 'com.axelor.apps.purchase.db.PurchaseOrder'" />
	</action-attrs>

	<action-attrs if-module="axelor-business-project" name="action-purchase-order-line-attrs-title-project">
		<attribute name="title" for="project" expr="eval: __config__.app.getApp('project').getProjectLabel()" if="__config__.app.isApp('project') &amp;&amp; !com.google.common.base.Strings.isNullOrEmpty(__config__.app.getApp('project').getProjectLabel())"/>
		<attribute name="title" for="projectPanel" expr="eval: __config__.app.getApp('project').getProjectLabel()" if="__config__.app.isApp('project')  &amp;&amp;  !com.google.common.base.Strings.isNullOrEmpty(__config__.app.getApp('project').getProjectLabel())"/>
	</action-attrs>
	
	<action-attrs name="action-purchase-order-line-attrs-show-priceDiscounted">
		<attribute name="hidden" for="priceDiscounted" expr="eval: priceDiscounted == price" if="_parent?._model == 'com.axelor.apps.purchase.db.PurchaseOrder' &amp;&amp; !_parent?.inAti"/>
		<attribute name="hidden" for="priceDiscounted" expr="eval: priceDiscounted == inTaxPrice" if="_parent?._model == 'com.axelor.apps.purchase.db.PurchaseOrder' &amp;&amp; _parent?.inAti"/>
		<attribute name="hidden" for="priceDiscounted" expr="eval: priceDiscounted == price" if="purchaseOrder != null &amp;&amp; _parent?._model != 'com.axelor.apps.purchase.db.PurchaseOrder' &amp;&amp; !purchaseOrder?.inAti"/>
		<attribute name="hidden" for="priceDiscounted" expr="eval: priceDiscounted == inTaxPrice" if="purchaseOrder != null &amp;&amp; _parent?._model != 'com.axelor.apps.purchase.db.PurchaseOrder' &amp;&amp; purchaseOrder?.inAti"/>
	</action-attrs>
	
	<action-attrs name="action-purchase-order-line-attrs-hide-qty-warning-label">
		<attribute name="hidden" for="minQtyNotRespectedLabel" expr="true"/>
		<attribute name="hidden" for="multipleQtyNotRespectedLabel" expr="true"/>
		<attribute name="hidden" for="qtyValid" expr="true"/>
	</action-attrs>
	
	<!-- ACTION RECORD -->
	
    <action-record name="action-purchase-order-line-record-new" model="com.axelor.apps.purchase.db.PurchaseOrderLine">
    	<field name="qty" expr="eval: 1"/>
    	<field name="desiredDelivDate" expr="eval: _parent?.deliveryDate"/>
    	<field name="$isFilterOnSupplier" expr="eval: true"/>
    	<field name="estimatedDelivDate" expr="eval: _parent?.deliveryDate" if="_parent != null &amp;&amp; _parent._model == 'com.axelor.apps.purchase.db.PurchaseOrder' &amp;&amp; receiptState &lt; 2"/>
    </action-record>
    
    <action-record name="action-purchase-order-line-record-project" model="com.axelor.apps.purchase.db.PurchaseOrderLine" if-module="axelor-business-project">
		<field name="project" expr="eval: _parent?.project" if="__config__.app.isApp('business-project')" />
		<field name="toInvoice" expr="eval: __parent__?.project?.isInvoicingPurchases" if="__config__.app.isApp('business-project')"/>
	</action-record>
    
   	<!-- ACTION METHOD -->
   	
   	<action-method name="action-purchase-order-line-method-convert-tax">
		<call class="com.axelor.apps.purchase.web.PurchaseOrderLineController" method="convertUnitPrice"/>
	</action-method>
	
	<action-method name="action-purchase-order-line-method-compute">
		<call class="com.axelor.apps.purchase.web.PurchaseOrderLineController" method="compute"/>
	</action-method>
	
	<action-method name="action-purchase-order-line-method-get-product-information">
		<call class="com.axelor.apps.purchase.web.PurchaseOrderLineController" method="getProductInformation"/>
	</action-method>
	
	<action-method name="action-purchase-order-line-method-update-product-information">
		<call class="com.axelor.apps.purchase.web.PurchaseOrderLineController" method="updateProductInformation"/>
	</action-method>
	
	<action-method name="action-purchase-order-line-method-generate-suppliers-requests">
		<call class="com.axelor.apps.suppliermanagement.web.PurchaseOrderLineController" method="generateSuppliersRequests"/>
	</action-method>

	<action-method name="action-purchase-order-line-method-check-qty">
		<call class="com.axelor.apps.purchase.web.PurchaseOrderLineController" method="checkQty"/>
	</action-method>

	<action-method name="action-purchase-order-line-method-get-tax-equiv">
		<call class="com.axelor.apps.purchase.web.PurchaseOrderLineController" method="getTaxEquiv"/>
	</action-method>
	
	<action-method name="action-purchase-order-line-set-supplierPartner-domain">
		<call class="com.axelor.apps.purchase.web.PurchaseOrderLineController" method="supplierPartnerDomain"/>
	</action-method>
	
	<action-method name="action-purchase-order-line-method-onchange-price">
		<call class="com.axelor.apps.purchase.web.PurchaseOrderLineController" method="updateInTaxPrice"/>
	</action-method>
	
	<action-method name="action-purchase-order-line-method-onchange-intaxprice">
		<call class="com.axelor.apps.purchase.web.PurchaseOrderLineController" method="updatePrice"/>
	</action-method>

	<action-method name="action-purchase-order-method-compute-budget-distribution-sum-amount">
		<call class="com.axelor.apps.supplychain.web.PurchaseOrderLineController" method="computeBudgetDistributionSumAmount"/>
	</action-method>

	<!-- ACTION ATTRS -->
	
	<action-attrs name="action-purchase-order-line-attrs-product-domain">
		<attribute name="domain" for="product"
		expr="eval: isFilterOnSupplier &amp;&amp; __config__.app.getApp('purchase').getManageSupplierCatalog()
		? &quot; self.isModel = false and self.expense = false and (self.endDate = null or self.endDate &gt; :__date__) and self.purchasable = true and self.id IN (SELECT product.id FROM SupplierCatalog WHERE supplierPartner.id = ${_parent?.supplierPartner?.id}) &quot; 
		: &quot; self.isModel = false and self.expense = false and (self.endDate = null or self.endDate &gt; :__date__) and self.purchasable = true &quot;" />
	</action-attrs>
	
    <action-attrs name="action-purchase-order-line-attrs-discountamount-title">
		<attribute name="title" for="discountAmount" expr="eval: com.axelor.i18n.I18n.get('Discount rate')" if="discountTypeSelect == 1"/>
		<attribute name="title" for="discountAmount" expr="eval: com.axelor.i18n.I18n.get('Discount amount')" if="discountTypeSelect == 2"/>
	</action-attrs>

    <action-attrs name="action-purchase-order-line-attrs-scale-and-precision">
		<attribute name="scale" for="price" expr="eval: __config__.app.getNbDecimalDigitForUnitPrice()"/>
		<attribute name="scale" for="inTaxPrice" expr="eval: __config__.app.getNbDecimalDigitForUnitPrice()"/>
		<attribute name="scale" for="priceDiscounted" expr="eval: __config__.app.getNbDecimalDigitForUnitPrice()"/>
		<attribute name="scale" for="discountAmount" expr="eval: __config__.app.getNbDecimalDigitForUnitPrice()"/>
		<attribute name="scale" for="saleMinPrice" expr="eval: __config__.app.getNbDecimalDigitForUnitPrice()"/>
	</action-attrs>
	
	<action-attrs name="action-purchase-order-line-attrs-readonly-form">
		<attribute name="readonly" for="informationsPanel" expr="eval: __parent__?.statusSelect &gt; 2"/>
		<attribute name="readonly" for="supplierRequestsPanel" expr="eval: __parent__?.statusSelect &gt; 2"/>
		<attribute name="readonly" for="budgetDistributionPanel" expr="eval: __parent__?.statusSelect &gt; 2"/>
		<attribute name="readonly" for="projectPanel" expr="eval: __parent__?.statusSelect &gt; 3"/>
		<attribute name="readonly" for="budgetPanel" expr="eval: __parent__?.statusSelect &gt; 2"/>
		<attribute name="readonly" for="deliveryInformationPanel" expr="eval: __parent__?.statusSelect &gt; 3"/>
	</action-attrs>

	<action-attrs name="action-purchase-order-line-attrs-set-isFilterOnSupplier">
		<attribute name="value" for="$isFilterOnSupplier" expr="eval: true"/>
	</action-attrs>
    
<!--     ACTION VIEW -->
    <action-view name="action-purchase-order-line-view-stock-move-line" title="" model="com.axelor.apps.stock.db.StockMoveLine">
  		<view type="grid" name="stock-move-line-all-grid"/>
		<view type="form" name="stock-move-line-all-form"/>
  		<domain>self.purchaseOrderLine.id = :id</domain>
  		<context name="id" expr="eval: id"/>
  	</action-view>
	
</object-views>
