<?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="sale-order-line-grid" title="SO lines" model="com.axelor.apps.sale.db.SaleOrderLine">
   		<hilite strong="true" color="default" if="typeSelect != 0"/>
		<hilite color="danger" if="deliveryState == 1"/>
		<hilite color="warning" if="deliveryState == 2"/>
		<hilite color="success" if="deliveryState == 3"/>
		<field name="sequence" if="__config__.app.getApp('sale')?.isDisplaySaleOrderLineNumber" width="51"/>
		<field name="typeSelect" hidden="true"/>
		<field name="deliveryState" hidden="true" if="__config__.app.isApp('supplychain')" />
		<field name="product.code" width="120"/>
		<field name="productName"/>
		<field name="qty" aggregate="sum"/>
		<field name="reservedQty" if="__config__.app.getApp('supplychain')?.manageStockReservation" aggregate="sum"/>
    <button name="allocateAll" if="__config__.app.getApp('supplychain')?.manageStockReservation" title="Allocate" icon="fa-plus-square" readonlyIf="$get('saleOrder.statusSelect') != 3 || $get('saleOrder.orderBeingEdited') || $number(reservedQty) == $number(qty)" onClick="save,action-supplychain-sale-order-line-allocate-all"/>
		<button name="deallocate"  if="__config__.app.getApp('supplychain')?.manageStockReservation" title="Deallocate" icon="fa-minus-square" readonlyIf="$get('saleOrder.statusSelect') != 3 || $get('saleOrder.orderBeingEdited') || $number(reservedQty) == 0" onClick="save,action-supplychain-sale-order-line-deallocate-all"/>
		<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="estimatedDelivDate"/>
    <field name="saleOrder.statusSelect" hidden="true"/>
    <field name="saleOrder.orderBeingEdited" hidden="true"/>
	</grid>

    <grid name="sale-order-line-menu-grid" title="SO lines" model="com.axelor.apps.sale.db.SaleOrderLine" canNew="false" canDelete="false" canEdit="false">
      	<field name="saleOrder"/>
      	<field name="saleOrder.company"/>
      	<field name="saleOrder.stockLocation" if="__config__.app.isApp('supplychain')"/>
  		<field name="saleOrder.clientPartner"/>
  		<field name="product.code" width="120"/>
	    <field name="productName"/>
	    <field name="qty" aggregate="sum"/>
	    <field name="deliveredQty" aggregate="sum"/>
		<field name="reservedQty" if="__config__.app.getApp('supplychain')?.manageStockReservation" 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="exTaxTotal" aggregate="sum"/>
   		<field name="estimatedDelivDate"/>
   		<field name="saleOrder.confirmationDateTime"/>
	</grid>
    
    <grid name="sale-order-line-invoice-grid" title="SO lines" model="com.axelor.apps.sale.db.SaleOrderLine">
      	<field name="saleOrder"/>
  		<field name="saleOrder.inTaxTotal"/>
  		<field name="product.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="exTaxTotal" aggregate="sum"/>
	    <field name="inTaxTotal" aggregate="sum"/>
	</grid>

    <form name="sale-order-line-project-form" title="SO line" model="com.axelor.apps.sale.db.SaleOrderLine" onLoad="action-group-sale-saleorderline-onload,action-sale-order-line-attrs-hidden-fields-for-client" 
    		readonlyIf="true" canEdit="false">
        <panel name="mainPanel" title="Sale order">
            <field name="saleOrder.saleOrderSeq" title="Reference" colSpan="4"/>
            <field name="saleOrder.creationDate" colSpan="4"/>
            <field name="saleOrder.currency" colSpan="4"/>
        </panel>
        <panel-include view="sale-order-line-form"/>
    </form>

	<form name="sale-order-line-form" title="SO line" model="com.axelor.apps.sale.db.SaleOrderLine"
		  onLoad="action-group-sale-saleorderline-onload,action-sale-order-line-attrs-hidden-fields-for-client"
		  onNew="action-group-sale-saleorderline-onnew" width="large">

		<panel name="productPanel" showIf="typeSelect == 1">
			<field name="productName" colSpan="9" title="Title"/>
			<field name="typeSelect" colSpan="3" onChange="action-sale-order-line-method-empty-line,action-sale-order-attrs-hide-ati" selection-in="[0,1]"/>
		</panel>
 
		<panel-tabs name="mainPanelTab" hideIf="typeSelect == 1">
			<panel name="informationsPanel" title="Information">
       <!-- The condition $isReadOnly !== false is used to manage the case where isReadOnly is null. -->
			<panel name="productInfoPanel" colSpan="12" readonlyIf="$isReadOnly !== false || deliveryState == 3">
        <panel name="tagPanel" colSpan="12">
  				<field name="$viewerTag" showTitle="false" showIf="product != null" readonly="true" colSpan="2">
					<viewer depends="product.isUnrenewed,product.isPrototype"><![CDATA[
					 	<h4>
	                        <span class="label label-important" ng-show="record.product.isUnrenewed" x-translate>Unrenewed</span>
	                        <span class="label label-important" ng-show="record.product.isPrototype" x-translate>Prototype</span>
	                    </h4>
					]]>
					</viewer>
				</field>
  				<field name="invoiced" showTitle="false" showIf="id &amp;&amp; $readonly() &amp;&amp; exTaxTotal > 0" colSpan="2" if-module="axelor-supplychain" if="__config__.app.isApp('supplychain')">
					<viewer depends="amountInvoiced,exTaxTotal"><![CDATA[
                        <h4>
                            <span class="label label-success" ng-show="record.amountInvoiced > 0 && record.amountInvoiced == record.exTaxTotal" x-translate>Invoiced</span>
                            <span class="label label-warning" ng-show="record.amountInvoiced > 0 && $number(record.amountInvoiced) < $number(record.exTaxTotal)" x-translate>Partially invoiced</span>
                            <span class="label label-important" ng-show="record.amountInvoiced == 0" x-translate>Not invoiced</span>
                        </h4>
                    ]]>
					</viewer>
				</field>
				<field name="deliveryState" showTitle="false" colSpan="2" showIf="deliveryState > 0" if-module="axelor-supplychain" if="__config__.app.isApp('supplychain')">
					<viewer><![CDATA[
	                    <h4>
	                        <span class="label label-important" ng-show="record.deliveryState == 1" x-translate>Not delivered</span>
	                        <span class="label label-warning" ng-show="record.deliveryState == 2" x-translate>Partially delivered</span>
	                        <span class="label label-success" ng-show="record.deliveryState == 3" x-translate>Delivered</span>
	                    </h4>
					]]></viewer>
				</field>
				<field name="$availabiltyRequest" showIf="$availabiltyRequest" showTitle="false" type="boolean" colSpan="2" if-module="axelor-supplychain" if="__config__.app.isApp('supplychain')">
					<viewer><![CDATA[
						<h4>
							<span class="label label-success" ng-show="record.$availabiltyRequest" x-translate>Availability request</span>
						</h4>
					]]></viewer>
				</field>

				<field name="isQtyRequested" showTitle="false" colSpan="2" showIf="isQtyRequested" if-module="axelor-supplychain" if="__config__.app.isApp('supplychain')">
					<viewer><![CDATA[
						<h4>
							<span class="label label-success" ng-show="record.isQtyRequested" x-translate>Reservation requested</span>
						</h4>
					]]></viewer>
				</field>

				</panel>
				<field name="product.isUnrenewed" hidden="true"/>
        		<field name="product.isPrototype" hidden="true"/>
				<field name="product" canEdit="false" onChange="action-group-sale-saleorderline-product-onchange" onSelect="action-sale-order-line-attrs-domain-product" form-view="product-form" grid-view="product-grid" if="!__config__.app.isApp('supplychain')"/>
				<field name="product" canEdit="false" onChange="action-group-sale-saleorderline-product-onchange" onSelect="action-sale-order-line-attrs-domain-product" form-view="product-form" grid-view="stock-move-line-product-grid" if="__config__.app.isApp('supplychain')"/>
				<field name="typeSelect" colSpan="2" onChange="action-sale-order-line-method-empty-line,action-sale-order-attrs-hide-ati" selection-in="[0,1]"/>
				<field name="packPriceSelect" showIf="typeSelect == 2 &amp;&amp; product != null" colSpan="4" onChange="action-group-sale-order-line-pack-price-select-onchange"  if="(__config__.app.isApp('sale') &amp;&amp; __config__.app.getApp('sale').getProductPackMgt())" />
				<field name="productName" colSpan="12"/>
				<field name="oldQty"/>
			</panel>
				<panel name="productDetailPanel" colSpan="12">
					<field name="qty" colSpan="3" onChange="action-group-sale-saleorderline-qty-onchange" readonlyIf="$availabiltyRequest || isSubLine || ($isReadOnly !== false &amp;&amp; !$get('saleOrder.orderBeingEdited'))" validIf="$qtyValid != false"/>
					<field name="unit" colSpan="3" readonlyIf="typeSelect == 2 || isSubLine || $isReadOnly !== false || deliveryState == 3" canEdit="false" form-view="unit-form" grid-view="unit-grid"/>
					<field name="price" colSpan="3" readonlyIf="$isReadOnly !== false || deliveryState == 3" onChange="action-sale-order-line-method-onchange-price,action-sale-order-line-method-compute,action-sale-order-line-method-compute-analytic-distribution" hidden="true"/>
					<field name="inTaxPrice" colSpan="3" readonlyIf="$isReadOnly !== false || deliveryState == 3" onChange="action-sale-order-line-method-onchange-intaxprice,action-sale-order-line-method-compute,action-sale-order-line-method-compute-analytic-distribution" hidden="true"/>
					<panel name="discountPanel" colSpan="12" readonlyIf="$isReadOnly !== false || deliveryState == 3">
						<field name="discountTypeSelect" colSpan="3" onChange="action-sale-order-line-method-compute,action-sale-order-line-attrs-discountamount-title,action-sale-order-line-method-compute-analytic-distribution"/>
						<field name="discountAmount" colSpan="3" onChange="action-sale-order-line-method-compute,action-sale-order-line-method-compute-analytic-distribution" hideIf="discountTypeSelect == 0"/>
						<field name="priceDiscounted" colSpan="3" hidden="true" readonly="true"/>
					</panel>
					<label name="multipleQtyNotRespectedLabel" hidden="true" colSpan="12"/>
					<field name="$qtyValid" hidden="true" colSpan="12"/>
				</panel>

				<panel name="taxPanel" colSpan="12">
					<field name="taxLine" canEdit="false" colSpan="6" readonlyIf="$isReadOnly !== false || deliveryState == 3" onChange="action-group-sale-saleorderline-tax-line-onchange" domain="self.endDate = null or self.endDate &gt; :__date__" grid-view="tax-line-grid" form-view="tax-line-form"/>
					<field name="exTaxTotal" readonly="true" colSpan="3"/>
					<field name="inTaxTotal" readonly="true" colSpan="3"/>
					<field name="isSubLine" hideIf="!isSubLine" readonlyIf="$isReadOnly !== false" if="(__config__.app.isApp('sale') &amp;&amp; __config__.app.getApp('sale').getProductPackMgt())"/>
					<field name="parentLine" hideIf="!isSubLine || parentLine == null" readonlyIf="$isReadOnly !== false"/>
				</panel>
        <panel name="reservationPanel" colSpan="12" if-module="axelor-supplychain" if="__config__.app.isApp('supplychain')">
					<field name="requestedReservedQty" colSpan="6" hidden="true" if-module="axelor-supplychain"
						onChange="action-supplychain-attrs-sale-order-line-max-requested-reserved-qty"
						if="__config__.app.getApp('supplychain').getManageStockReservation()"/>
					<field name="reservedQty" colSpan="6" readonly="true" hidden="true" if-module="axelor-supplychain" if="__config__.app.getApp('supplychain').getManageStockReservation()"/>
            <field hidden="true" name="isQtyRequested"/>
        <panel name="requestedQtyBtnsPanel" colSpan="12" if-module="axelor-supplychain" if="__config__.app.getApp('supplychain').getManageStockReservation()">
					<button name="updateRequestedReservedQtyBtn" colSpan="6" hidden="true" title="Change requested reserved qty" onClick="action-view-sale-order-line-requested-reserved-qty-wizard"/>
				</panel>
        <panel name="reservedQtyBtnsPanel" colSpan="12" if-module="axelor-supplychain" if="__config__.app.getApp('supplychain').getManageStockReservation()">
					<button name="updateAllocatedQtyBtn" colSpan="6" hidden="true" title="Change allocated qty" onClick="action-view-sale-order-line-allocated-qty-wizard"/>
				</panel>
        <panel name="requestedReservedQtyBtnqPanel" colSpan="12" if-module="axelor-supplychain" if="__config__.app.getApp('supplychain').getManageStockReservation()">
          <button name="requestQty" title="Request reservation" showIf="!isQtyRequested" onClick="save,action-method-sale-order-line-request-qty"/>
        </panel>
        <panel name="cancelReservedQtyBtnqPanel" colSpan="12" if-module="axelor-supplychain" if="__config__.app.getApp('supplychain').getManageStockReservation()">
          <button name="cancelReservation" title="Cancel reservation" showIf="isQtyRequested" onClick="save,action-method-sale-order-line-cancel-reservation"/>
        </panel>
        </panel>
				<field name="$availableStock" colSpan="3" readonly="true" type="decimal" title="Available stock" if-module="axelor-supplychain"  if="__config__.app.getApp('supplychain').getManageStockReservation()"/>
				<field name="$allocatedStock" colSpan="3" readonly="true" type="decimal" title="Allocated stock" if-module="axelor-supplychain" if="__config__.app.getApp('supplychain').getManageStockReservation()"/>
				<field name="$totalStock" colSpan="3" readonly="true" type="decimal" title="Total stock" if-module="axelor-supplychain" if="__config__.app.getApp('supplychain').getManageStockReservation()"/>
				<field name="taxEquiv" hidden="true" grid-view="tax-equiv-grid" form-view="tax-equiv-form"/>
				<panel name="descriptionPanel" title="Description" colSpan="12" readonlyIf="$isReadOnly !== false">
					<field name="description" showTitle="false" colSpan="12" widget="Html" x-lite="true"/>
				</panel>
				<field name="$isReadOnly" hidden="true"/>
			</panel>
			<panel name="packPanel" title="Pack lines" showIf="typeSelect == 2" readonlyIf="packPriceSelect == 0 || $isReadOnly !== false" if="__config__.app.isApp('sale') &amp;&amp; __config__.app.getApp('sale').getProductPackMgt()" >
				<panel-related name="subLineListPanel" field="subLineList" onChange="action-sale-order-line-compute-total-pack" colSpan="12" form-view="sale-order-line-form" grid-view="sale-order-line-grid" canNew="false" canRemove="false"/>
				<field name="totalPack" readonly="true"/>
			</panel>
			<panel name="marginPanel" title="Margin" readonlyIf="$isReadOnly !== false">
				<field name="subTotalCostPrice" onChange="action-sale-order-line-method-compute-subMargin"/>
				<field name="subTotalGrossMargin" readonly="true"/>
				<field name="subMarginRate" readonly="true"/>
				<field name="subTotalMarkup" readonly="true"/>
				<field name="$companyCurrency" readonly="true" title="Currency" type="many-to-one" target="com.axelor.apps.base.db.Currency"/>
			</panel>
			<panel name="deliveryPanel" title="Delivery">
				<field name="desiredDelivDate" readonlyIf="$availabiltyRequest"/>
				<field name="estimatedDelivDate" readonlyIf="$availabiltyRequest"/>
				<field name="deliveredQty" readonly="true" readonlyIf="$isReadOnly !== false"/>
                <button name="$previewBtn" title="See stock details"  icon="fa-cubes" colSpan="4" widget="info-button" onClick="action-stock-location-line-view-for-a-product-from-saleorderline-view" if-module="axelor-supplychain"/>
				<field name="pickingOrderInfo" colSpan="12" if-module="axelor-supplychain" if="__config__.app.isApp('supplychain')" readonlyIf="$isReadOnly !== false"/>
				<panel-dashlet name="stockMoveLineOfSOPanel" title="Stock Moves" action="action-sale-order-line-view-stock-move-line" colSpan="12" if-module="axelor-supplychain" if="__config__.app.isApp('supplychain')" readonlyIf="$isReadOnly !== false"/>
			</panel>
			<panel name="invoicingFollowUpPanel" title="Invoicing" readonlyIf="$isReadOnly !== false" if-module="axelor-supplychain" if="__config__.app.isApp('supplychain')">
				<field name="invoicingDate"/>
				<field name="amountInvoiced" />
				<panel-dashlet name="invoiceLinesFromSOLinePanel" action="action-sale-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').getProjectSaleOrderLines()" title="Business Project" readonlyIf="$isReadOnly !== false" if-module="axelor-business-project">
				<field name="project" title="Business Project" canEdit="false" onSelect="action-sale-order-line-attrs-domain-project" onChange="action-sale-order-line-record-progress" form-view="project-form" grid-view="project-grid"/>
				<field name="toInvoice" colSpan="3" if="__config__.app.isApp('business-project') &amp;&amp; __config__.app.getApp('business-project').getProjectSaleOrderLines()" if-module="axelor-business-project" />
				<panel-dashlet name="teamTaskListPanel" title="Related tasks" action="action-sale-order-line-view-team-tasks" colSpan="12"/>
			</panel>
			<panel name="analyticDistributionPanel" title="Analytics" if-module="axelor-supplychain" if="__config__.app.isApp('supplychain') &amp;&amp; __config__.app.getApp('account').getManageAnalyticAccounting()" onTabSelect="action-sale-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-sale-order-line-method-create-distribution" onSelect="action-sale-order-line-attrs-set-domain-analytic-distribution-template"/>
				<panel-related name="analyticMoveLineListPanel" readonlyIf="$isReadOnly !== false" field="analyticMoveLineList" grid-view="analytic-move-line-distribution-grid" form-view="analytic-move-line-distribution-form" colSpan="12"/>
			</panel>
			<panel name="settingsPanel" readonlyIf="$isReadOnly !== false" title="Configuration" >
				<field name="saleSupplySelect" onChange="action-group-sale-saleorderline-salesupplyselect-onchange" if-module="axelor-supplychain" if="__config__.app.isApp('supplychain')" />
				<field name="standardDelay" if-module="axelor-supplychain" if="__config__.app.isApp('supplychain')" hidden="true"  showIf="saleSupplySelect == 2 || saleSupplySelect ==3" />
				<field name="supplierPartner" showIf="saleSupplySelect == 2" onSelect="action-sale-order-line-method-supplier-partner-domain" form-view="partner-form" grid-view="partner-grid"/>
				<field name="billOfMaterial" onSelect="action-sale-order-line-attrs-bill-of-material-domain" if-module="axelor-production" form-view="bill-of-material-form" grid-view="bill-of-material-grid" if="__config__.app.isApp('production')" />
				<button name="customizeBOMBtn" title="Customize BOM" onClick="action-production-method-customize-bill-of-material" if-module="axelor-production" if="__config__.app.isApp('production')" />
			</panel>
		</panel-tabs>
		<panel name="attrsPanel">
			<field name="attrs" colSpan="12" />
		</panel>
		<panel name="statusPanel" hidden="true">
			<field name="saleOrder.statusSelect" />
			<field name="saleOrder.orderBeingEdited" />
		</panel>
  		<panel-mail name="mailsPanel">
    		<mail-messages />
    	</panel-mail>
	</form>

	<form name="sale-order-line-template-form" title="SO line" model="com.axelor.apps.sale.db.SaleOrderLine"
		  onLoad="action-group-sale-saleorderline-onload,action-sale-order-line-template-attrs-hidden-fields-for-client" onNew="action-group-sale-saleorderline-onnew" width="large">
		<panel name="product1Panel" showIf="typeSelect == 1">
			<field name="productName" colSpan="9" title="Title"/>
			<panel name="typeSelect1Panel" colSpan="3">
				<field name="typeSelect" onChange="action-sale-order-line-method-empty-line" selection-in="[0,1]" if="!(__config__.app.isApp('sale') &amp;&amp; __config__.app.getApp('sale').getProductPackMgt())" colSpan="12"/>
				<field name="typeSelect" onChange="action-sale-order-line-method-empty-line,action-sale-order-attrs-hide-ati" selection-in="[0,1,2]" if="(__config__.app.isApp('sale') &amp;&amp; __config__.app.getApp('sale').getProductPackMgt())" colSpan="12"/>
			</panel>
		</panel>
		<panel name="product2Panel" hideIf="typeSelect == 1">
			<field name="product" canEdit="false" onChange="action-group-sale-saleorderline-product-onchange" onSelect="action-sale-order-line-attrs-domain-product" form-view="product-form" grid-view="product-grid"/>
			<panel name="typeSelect2Panel" colSpan="3">
				<field name="typeSelect" onChange="action-sale-order-line-method-empty-line" selection-in="[0,1]" if="!(__config__.app.isApp('sale') &amp;&amp; __config__.app.getApp('sale').getProductPackMgt())" colSpan="12"/>
				<field name="typeSelect" onChange="action-sale-order-line-method-empty-line,action-sale-order-attrs-hide-ati" selection-in="[0,1,2]" if="(__config__.app.isApp('sale') &amp;&amp; __config__.app.getApp('sale').getProductPackMgt())" colSpan="12"/>
			</panel>
			<field name="packPriceSelect" showIf="typeSelect == 2 &amp;&amp; product != null" colSpan="3" onChange="action-group-sale-order-line-pack-price-select-onchange"  if="(__config__.app.isApp('sale') &amp;&amp; __config__.app.getApp('sale').getProductPackMgt())" />
			<field name="productName"/>
			<panel name="productDetailsPanel" colSpan="12">
				<field name="qty"  onChange="action-group-sale-saleorderline-qty-onchange" readonlyIf="isSubLine"/>
				<field name="unit" readonlyIf="isSubLine || typeSelect == 2" canEdit="false" form-view="unit-form" grid-view="unit-grid"/>
				<field name="price"  onChange="action-sale-order-line-method-onchange-price,action-sale-order-line-method-compute,action-sale-order-line-method-compute-analytic-distribution" colSpan="4" hidden="true"/>
				<field name="inTaxPrice" onChange="action-sale-order-line-method-onchange-intaxprice,action-sale-order-line-method-compute,action-sale-order-line-method-compute-analytic-distribution" colSpan="4" hidden="true"/>
				<panel name="discountPanel" title="Discount">
					<field name="discountTypeSelect" onChange="action-sale-order-line-method-compute,action-sale-order-line-attrs-discountamount-title,action-sale-order-line-method-compute-analytic-distribution"/>
					<field name="discountAmount" onChange="action-sale-order-line-method-compute,action-sale-order-line-method-compute-analytic-distribution" hideIf="discountTypeSelect == 0"/>
					<field name="priceDiscounted" colSpan="4" hidden="true"/>
				</panel>
			</panel>
			<field name="taxLine" canEdit="false"  colSpan="4" onChange="action-group-sale-saleorderline-tax-line-onchange" domain="self.endDate = null or self.endDate &gt; :__date__" grid-view="tax-line-grid" form-view="tax-line-form"/>
			<field name="exTaxTotal" readonly="true"/>
			<field name="inTaxTotal" readonly="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-tabs hideIf="typeSelect == 1" name="allPanelTab">
			<panel name="packPanel" title="Pack lines" showIf="typeSelect == 2" if="__config__.app.isApp('sale') &amp;&amp; __config__.app.getApp('sale').getProductPackMgt()" >
				<panel-related name="subLineListPanel" field="subLineList" onChange="action-sale-order-line-compute-total-pack" colSpan="12" form-view="sale-order-line-form" grid-view="sale-order-line-grid"/>
				<field name="totalPack" readonly="true"/>
			</panel>
			<panel name="marginPanel" title="Margin">
				<field name="subTotalCostPrice" onChange="action-sale-order-line-method-compute-subMargin"/>
				<field name="subTotalGrossMargin" readonly="true"/>
				<field name="subMarginRate" readonly="true"/>
				<field name="subTotalMarkup" readonly="true"/>
				<field name="$companyCurrency" readonly="true" title="Currency" type="many-to-one" target="com.axelor.apps.base.db.Currency"/>
			</panel>
			<panel name="projectPanel"  if="__config__.app.isApp('business-project') &amp;&amp; __config__.app.getApp('business-project').getProjectSaleOrderLines()" title="Project/Task" if-module="axelor-business-project">
				<field name="project" onSelect="action-sale-order-line-attrs-domain-project" onChange="action-sale-order-line-record-progress" form-view="project-form" grid-view="project-grid"/>
				<field name="progress" readonly="true" widget="SelectProgress"/>
			</panel>
			<panel name="analyticDistributionPanel" readonlyIf="$isReadOnly !== false" title="Analytics" if-module="axelor-supplychain" if="__config__.app.isApp('supplychain') &amp;&amp; __config__.app.getApp('account').getManageAnalyticAccounting()" onTabSelect="action-sale-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-sale-order-line-method-create-distribution" onSelect="action-sale-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 name="settingsPanel" title="Settings">
				<field name="saleSupplySelect" onChange="action-group-sale-saleorderline-salesupplyselect-onchange" if-module="axelor-supplychain" if="__config__.app.isApp('supplychain')" />
				<field name="standardDelay" if-module="axelor-supplychain" hidden="true" showIf="saleSupplySelect == 2 || saleSupplySelect ==3" />
				<field name="supplierPartner" showIf="saleSupplySelect == 2"  onSelect="action-sale-order-line-method-supplier-partner-domain" form-view="partner-form" grid-view="partner-grid"/>
				<field name="billOfMaterial" onSelect="action-sale-order-line-attrs-bill-of-material-domain" if-module="axelor-production" form-view="bill-of-material-form" grid-view="bill-of-material-grid" if="__config__.app.isApp('production')" />
				<button name="customizeBOMBtn" title="Customize BOM" onClick="action-production-method-customize-bill-of-material" if-module="axelor-production" if="__config__.app.isApp('production')" />
			</panel>
		</panel-tabs>
		<panel name="attrsPanel">
			<field name="attrs" colSpan="12" />
		</panel>
	</form>
	
	<form name="sale-order-line-menu-form" title="SO line" model="com.axelor.apps.sale.db.SaleOrderLine" 
	onLoad="action-group-sale-saleorderline-onload" onNew="action-group-sale-saleorderline-onnew" width="large">
		<panel name="mainPanel" >
			<field name="saleOrder.clientPartner"/>
			<field name="saleOrder" grid-view="sale-order-grid" form-view="sale-order-form"/>
			<field name="saleOrder.company"/>
			<field name="saleOrder.stockLocation" if="__config__.app.isApp('supplychain')"/>
		</panel>
		<panel-include view="sale-order-line-form"/>
	</form>	
	
		<form name="sale-order-line-invoice-form" title="SO line" model="com.axelor.apps.sale.db.SaleOrderLine" 
	onLoad="action-group-sale-saleorderline-onload" onNew="action-group-sale-saleorderline-onnew" width="large">
		<panel name="mainPanel" >
			<field name="saleOrder" grid-view="sale-order-grid" form-view="sale-order-form"/>
		</panel>
		<panel-include view="sale-order-line-form"/>
	</form>

	<form model="com.axelor.apps.sale.db.SaleOrderLine" title="SO line" name="sale-order-line-all-form" width="large" canNew="false" canDelete="false" canEdit="false">
		<panel name="mainPanel">
			<field name="saleOrder.company" colSpan="3"/>
			<spacer name="saleOrderCompanySpacer" colSpan="9"/>
			<field name="saleOrder.clientPartner" grid-view="partner-grid" form-view="partner-form" colSpan="3"/>
			<field name="saleOrder.saleOrderSeq" grid-view="sale-order-grid" form-view="sale-order-form" colSpan="3"/>
			<field name="saleOrder.creationDate" colSpan="3"/>
			<field name="saleOrder.currency" colSpan="3"/>
		</panel>
		<panel-include view="sale-order-line-form"/>
	</form>

	<action-method name="action-sale-order-line-method-empty-line">
		<call class="com.axelor.apps.sale.web.SaleOrderLineController" method="emptyLine"/>
	</action-method>
	
	<action-method name="action-sale-order-line-method-create-distribution">
		<call class="com.axelor.apps.supplychain.web.SaleOrderLineController" method="createAnalyticDistributionWithTemplate"/>
	</action-method>
	
	<action-method name="action-sale-order-line-method-compute-analytic-distribution" if-module="axelor-supplychain">
		<call class="com.axelor.apps.supplychain.web.SaleOrderLineController" method="computeAnalyticDistribution" if="__config__.app.isApp('supplychain')" />
	</action-method>

	<action-method name="action-sale-order-line-method-check-stock" if-module="axelor-supplychain">
		<call class="com.axelor.apps.supplychain.web.SaleOrderLineController" method="checkStocks"/>
	</action-method>
	
	<action-method name="action-sale-order-pack-subline-method-update-qty">
		<call class="com.axelor.apps.sale.web.SaleOrderLineController" method="updateSubLineQty"/>
	</action-method>

	<action-attrs name="action-sale-order-line-attrs-read-only-distribution-lines">
		<attribute name="readonly" for="analyticMoveLineList" expr="eval: !__config__.app.isApp('account')  || __config__.app.getApp('account').getAnalyticDistributionTypeSelect() != 1"/>
	</action-attrs>
	
	<action-view name="action-sale-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.saleOrderLine.id = :saleOrderLineId</domain>
		<context name="saleOrderLineId" expr="eval: id" />
	</action-view>
	
	<action-attrs name="action-sale-order-line-attrs-domain-project">
		<attribute name="domain" for="project" expr="eval: &quot; self.clientPartner.id = ${_parent?.clientPartner?.id} AND self.isBusinessProject = true &quot;" if="_parent?._model == 'com.axelor.apps.sale.db.SaleOrder'"/>
		<attribute name="domain" for="project" expr="eval: &quot; self.clientPartner.id = ${saleOrder.clientPartner?.id} AND self.isBusinessProject = true &quot;" if="saleOrder != null &amp;&amp; _parent?._model != 'com.axelor.apps.sale.db.SaleOrder'"/>
	</action-attrs>

	<action-attrs name="action-sale-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-group name="action-group-sale-saleorderline-onnew">
      <action name="action-sale-order-line-record-is-form-readonly"/>
    	<action name="action-sale-order-line-attrs-hide-qty-warning-label"/>
    	<action name="action-sale-order-line-attrs-title-project"/>
    	<action name="action-sale-order-line-attrs-show-priceDiscounted"/>
    	<action name="action-sale-order-line-attrs-scale-and-precision"/>
    	<action name="action-sale-order-line-record-new"/>
    	<action name="action-sale-order-line-record-project"/>
    	<action name="action-sale-order-line-attrs-hide-bill-of-material"/>
    	<action name="action-sale-order-line-attrs-set-company-currency" />
    	<action name="action-sale-order-attrs-hide-ati"/>
    	<action name="action-sale-order-line-attrs-type-select"/>
		<action name="action-supplychain-sale-order-line-attrs-hide-button"/>
		<action name="action-sale-order-line-attrs-sub-line" if="(__config__.app.isApp('sale') &amp;&amp; __config__.app.getApp('sale').getProductPackMgt())"/>
		<action name="action-sale-order-line-attrs-fill-estimated-date"/>
		<action name="action-sale-order-line-attrs-is-requested-qty-readonly" if="__config__.app.isApp('supplychain') &amp;&amp; __config__.app.getApp('supplychain').getManageStockReservation()"/>
			<action name="action-sale-order-line-record-update-requested-reserved-qty-from-qty" if="__config__.app.isApp('supplychain') &amp;&amp; __config__.app.getApp('supplychain').getManageStockReservation()"/>
    </action-group>
    
    <action-group name="action-group-sale-saleorderline-onload">
    	<action name="action-sale-order-line-attrs-show-availabilty-request" if="__config__.app.isApp('supplychain')"/>
      <action name="action-sale-order-line-record-is-form-readonly"/>
    	<action name="action-sale-order-line-attrs-title-project"/>
    	<action name="action-sale-order-line-attrs-show-priceDiscounted"/>
    	<action name="action-sale-order-line-attrs-scale-and-precision"/>
    	<action name="action-sale-order-line-attrs-hide-bill-of-material"/>
    	<action name="action-sale-order-line-attrs-reserved-qty-visibility"/>
		<action name="action-method-sale-order-line-available-and-allocated-stock"/>
    	<action name="action-sale-order-line-attrs-set-company-currency" />
    	<action name="action-sale-order-line-attrs-type-select"/>
		<action name="action-supplychain-sale-order-line-attrs-hide-button"/>
		<action name="action-sale-order-line-method-check-qty"/>
		<action name="action-sale-order-attrs-hide-ati"/>
		<action name="action-sale-order-line-attrs-pack" if="typeSelect == 2 || isSubLine"/>
		<action name="action-sale-order-line-attrs-is-requested-qty-readonly" if="__config__.app.isApp('supplychain') &amp;&amp; __config__.app.getApp('supplychain').getManageStockReservation()"/>
      <action name="action-record-sale-order-line-future-qty" if="__config__.app.isApp('supplychain')"/>
    </action-group>

    <action-group name="action-group-sale-saleorderline-product-onchange">
    	<action name="action-sale-order-line-method-get-product-information" />
    	<action name="action-sale-order-line-method-compute" />
    	<action name="action-sale-order-line-attrs-hide-bill-of-material"/>
    	<action name="action-sale-order-line-get-production-information"/>
		<action name="action-sale-order-line-method-supplier-partner-default" if="__config__.app.isApp('supplychain')"/>
		<action name="action-sale-order-line-method-check-stock"
				if="__config__.app.isApp('supplychain') &amp;&amp; __config__.app.getApp('supplychain').getCheckSaleStocks()"/>
		<action name="action-sale-order-line-method-check-qty"/>
		<action if="__config__.app.isApp('supplychain')" name="action-sale-order-line-attrs-show-delivery-panel"/>
		<action name="action-sale-order-line-compute-total-pack" if="__config__.app.isApp('sale') &amp;&amp; __config__.app.getApp('sale').getProductPackMgt()" />
      <action name="action-method-sale-order-line-available-and-allocated-stock"/>
    	<action name="action-sale-order-attrs-hide-ati"/>
    	<action name="action-sale-order-line-attrs-pack" if="typeSelect == 2 || isSubLine"/>
      <action name="action-record-sale-order-line-future-qty" if="__config__.app.isApp('supplychain')"/>
    </action-group>

    <action-group name="action-group-sale-saleorderline-qty-onchange">
    	<action name="action-sale-order-line-method-check-delivered-or-invoiced-order-qty" if="__config__.app.isApp('supplychain') &amp;&amp; saleOrder?.statusSelect == 3"/>
    	<action name="action-sale-order-line-method-get-discount"/>
    	<action name="action-sale-order-line-method-compute"/>
    	<action name="action-sale-order-line-method-compute-analytic-distribution" if="__config__.app.isApp('supplychain') &amp;&amp; __config__.app.getApp('account').getManageAnalyticAccounting()"/>
		<action name="action-sale-order-line-method-check-stock"
				if="__config__.app.isApp('supplychain') &amp;&amp; __config__.app.getApp('supplychain').getCheckSaleStocks()"/>
		<action name="action-sale-order-line-method-check-qty"/>
		<action name="action-sale-order-pack-subline-method-update-qty" if="(__config__.app.isApp('sale') &amp;&amp; __config__.app.getApp('sale').getProductPackMgt())"/>
		<action name="action-sale-order-line-compute-total-pack" if="__config__.app.isApp('sale') &amp;&amp; __config__.app.getApp('sale').getProductPackMgt()" />
			<action name="action-sale-order-line-record-update-requested-reserved-qty-from-qty" if="__config__.app.isApp('supplychain') &amp;&amp; __config__.app.getApp('supplychain').getManageStockReservation()"/>
    </action-group>

	<action-group name="action-group-sale-saleorderline-tax-line-onchange">
		<action name="action-sale-order-line-method-get-tax-equiv"/>
		<action name="action-sale-order-line-method-convert-tax"/>
		<action name="action-sale-order-line-method-compute"/>
		<action name="action-sale-order-line-method-compute-analytic-distribution" if="__config__.app.isApp('supplychain') &amp;&amp; __config__.app.getApp('account').getManageAnalyticAccounting()"/>
	</action-group>

    <action-group name="action-group-sale-saleorderline-salesupplyselect-onchange" if-module="axelor-production">
    	<action name="action-sale-order-line-get-production-information" if="__config__.app.isApp('production')"/>
		<action name="action-sale-order-line-method-supplier-partner-default" if="__config__.app.isApp('production')"/>
    	<action name="action-sale-order-line-attrs-hide-bill-of-material" if="__config__.app.isApp('production')"/>
		<action name="action-sale-order-line-method-check-stock"
				if="__config__.app.isApp('supplychain') &amp;&amp; __config__.app.getApp('supplychain').getCheckSaleStocks()"/>
    </action-group>
    
    <action-group name="action-group-sale-order-line-pack-price-select-onchange">
    	<action name="action-sale-order-line-method-reset-pack-line"/>
    	<action name="action-sale-order-line-method-reset-pack-subline"/>
    	<action name="action-sale-order-line-compute-total-pack" />
    	<action name="action-sale-order-attrs-hide-ati"/>
    	<action name="action-sale-order-line-attrs-pack"/>
    </action-group>

    <action-attrs name="action-sale-order-attrs-hide-ati">
		<attribute name="hidden" for="exTaxTotal,price" expr="eval: _parent.inAti || typeSelect == 2 &amp;&amp; packPriceSelect == 1 || isSubLine &amp;&amp; parentLine?.packPriceSelect == 0" if="_parent?._model == 'com.axelor.apps.sale.db.SaleOrder'"/>
		<attribute name="hidden" for="subLineList.exTaxTotal,subLineList.price" expr="eval: _parent.inAti || typeSelect == 2 &amp;&amp; packPriceSelect == 0" if="_parent?._model == 'com.axelor.apps.sale.db.SaleOrder'"/>
		<attribute name="hidden" for="inTaxTotal,inTaxPrice" expr="eval: !_parent.inAti || typeSelect == 2 &amp;&amp; packPriceSelect == 1 || isSubLine &amp;&amp; parentLine?.packPriceSelect == 0" if="_parent?._model == 'com.axelor.apps.sale.db.SaleOrder'"/>
		<attribute name="hidden" for="subLineList.inTaxTotal,subLineList.inTaxPrice" expr="eval: !_parent.inAti || typeSelect == 2 &amp;&amp; packPriceSelect == 0" if="_parent?._model == 'com.axelor.apps.sale.db.SaleOrder'"/>
		
		<attribute name="hidden" for="exTaxTotal,price" expr="eval: saleOrder?.inAti || typeSelect == 2 &amp;&amp; packPriceSelect == 1 || isSubLine &amp;&amp; parentLine?.packPriceSelect == 0" if="saleOrder != null &amp;&amp; _parent?._model != 'com.axelor.apps.sale.db.SaleOrder'" />
		<attribute name="hidden" for="subLineList.exTaxTotal,subLineList.price" expr="eval: saleOrder?.inAti || typeSelect == 2 &amp;&amp; packPriceSelect == 0" if="saleOrder != null &amp;&amp; _parent?._model != 'com.axelor.apps.sale.db.SaleOrder'" />
		<attribute name="hidden" for="inTaxTotal,inTaxPrice" expr="eval: !saleOrder?.inAti || typeSelect == 2 &amp;&amp; packPriceSelect == 1 || isSubLine &amp;&amp; parentLine?.packPriceSelect == 0" if="saleOrder != null &amp;&amp; _parent?._model != 'com.axelor.apps.sale.db.SaleOrder'" />
		<attribute name="hidden" for="subLineList.inTaxTotal,subLineList.inTaxPrice" expr="eval: !saleOrder?.inAti || typeSelect == 2 &amp;&amp; packPriceSelect == 0" if="saleOrder != null &amp;&amp; _parent?._model != 'com.axelor.apps.sale.db.SaleOrder'" />

		<attribute name="hidden" for="exTaxTotal,price" expr="eval: _parent?._parent?.inAti || _parent?.packPriceSelect == 0" if="isSubLine &amp;&amp; _parent?._model == 'com.axelor.apps.sale.db.SaleOrderLine'" />
		<attribute name="hidden" for="inTaxTotal,inTaxPrice" expr="eval: !_parent?._parent?.inAti || _parent?.packPriceSelect == 0" if="isSubLine &amp;&amp; _parent._model == 'com.axelor.apps.sale.db.SaleOrderLine'" />
	</action-attrs>
	
	<action-attrs if-module="axelor-business-project" name="action-sale-order-line-attrs-title-project-task">
		<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-sale-order-line-attrs-show-priceDiscounted">
		  <attribute name="hidden" for="priceDiscounted" expr="eval: priceDiscounted == price" if="_parent?._model == 'com.axelor.apps.sale.db.SaleOrder' &amp;&amp; !_parent?.inAti"/>
		  <attribute name="hidden" for="priceDiscounted" expr="eval: priceDiscounted == inTaxPrice" if="_parent?._model == 'com.axelor.apps.sale.db.SaleOrder' &amp;&amp; _parent?.inAti"/>
		  <attribute name="hidden" for="priceDiscounted" expr="eval: priceDiscounted == price" if="saleOrder != null &amp;&amp; _parent?._model != 'com.axelor.apps.sale.db.SaleOrder' &amp;&amp; !saleOrder?.inAti"/>
		  <attribute name="hidden" for="priceDiscounted" expr="eval: priceDiscounted == inTaxPrice" if="saleOrder != null &amp;&amp; _parent?._model != 'com.axelor.apps.sale.db.SaleOrder' &amp;&amp; saleOrder?.inAti"/>
	</action-attrs>
	
	<action-attrs name="action-sale-order-line-attrs-hide-qty-warning-label">
		<attribute name="hidden" for="multipleQtyNotRespectedLabel" expr="true"/>
		<attribute name="hidden" for="qtyValid" expr="true"/>
	</action-attrs>

	<action-attrs name="action-sale-order-line-attrs-pack">
		<attribute name="hidden" for="discountPanel,taxLine,marginPanel" expr="eval:packPriceSelect == 1" if="typeSelect == 2"/>
		<attribute name="hidden" for="discountPanel,taxLine,marginPanel" expr="eval:_parent.packPriceSelect == 0"  if="isSubLine &amp;&amp; _parent._model == 'com.axelor.apps.sale.db.SaleOrderLine'"/>
		<attribute name="hidden" for="discountPanel,taxLine,marginPanel" expr="eval:parentLine.packPriceSelect == 0"  if="isSubLine &amp;&amp; _parent._model == 'com.axelor.apps.sale.db.SaleOrder'"/>
	</action-attrs>

	<action-attrs name="action-sale-order-line-attrs-show-availabilty-request">
		<attribute name="value" for="$availabiltyRequest" expr="eval:  id &amp;&amp; __repo__(StockMoveLine).all().filter('self.saleOrderLine.id = ? AND self.stockMove.availabilityRequest = TRUE AND self.stockMove.statusSelect = 2', __self__?.id).count() > 0"/>
	</action-attrs>

    <!-- ACTION RECORD -->

	<action-record name="action-sale-order-line-record-is-form-readonly" model="com.axelor.apps.sale.db.SaleOrderLine">
		<field name="$isReadOnly" expr="eval: saleOrder?.statusSelect == 2 || saleOrder?.statusSelect == 3 &amp;&amp; (!saleOrder?.orderBeingEdited || (exTaxTotal &amp;&amp; exTaxTotal != 0 &amp;&amp; amountInvoiced == exTaxTotal) || availabiltyRequest) || saleOrder?.statusSelect == 4 || isSubLine"/>
	</action-record>

    <action-record name="action-sale-order-line-record-new" model="com.axelor.apps.sale.db.SaleOrderLine">
    	<field name="qty" expr="eval: 1"/>
    </action-record>

    <action-record name="action-sale-order-line-record-project" model="com.axelor.apps.sale.db.SaleOrderLine" if-module="axelor-business-project">
		<field name="project" expr="eval: _parent?.project" if="__config__.app.isApp('business-project')" />
	</action-record>

<!--     TODO : should be splited per module -->
    <action-record name="action-sale-order-line-get-production-information" model="com.axelor.apps.sale.db.SaleOrderLine">
    	<field name="billOfMaterial" expr="eval: product?.defaultBillOfMaterial" if="__config__.app.isApp('production') &amp;&amp; saleSupplySelect == 3 &amp;&amp; product?.defaultBillOfMaterial != null"/>
    	<field name="billOfMaterial" expr="eval: product?.parentProduct?.defaultBillOfMaterial" if="__config__.app.isApp('production') &amp;&amp; saleSupplySelect == 3 &amp;&amp; product?.defaultBillOfMaterial == null"/>
    	<field name="standardDelay" expr="eval: product?.standardDelay" if="__config__.app.isApp('supplychain') &amp;&amp; saleSupplySelect == 2 || saleSupplySelect == 3" />
    	<field name="standardDelay" expr="eval: 0" if="__config__.app.isApp('supplychain') &amp;&amp; saleSupplySelect != 2 &amp;&amp; saleSupplySelect != 3" />
    </action-record>
    
    <action-record name="action-sale-order-line-record-progress" model="com.axelor.apps.sale.db.SaleOrderLine">
    	<field name="progress" expr="eval: project?.progress"/>
    </action-record>
    
   	<!-- ACTION METHOD -->
	<action-method name="action-sale-order-line-method-compute">
		<call class="com.axelor.apps.sale.web.SaleOrderLineController" method="compute"/>
	</action-method>
	
	<action-method name="action-sale-order-line-method-compute-subMargin">
		<call class="com.axelor.apps.sale.web.SaleOrderLineController" method="computeSubMargin"/>
	</action-method>

	<action-method name="action-sale-order-line-method-convert-tax">
		<call class="com.axelor.apps.sale.web.SaleOrderLineController" method="convertUnitPrice"/>
	</action-method>
	
	<action-method name="action-sale-order-line-method-get-product-information">
		<call class="com.axelor.apps.sale.web.SaleOrderLineController" method="getProductInformation"/>
	</action-method>
	
	<action-method name="action-sale-order-line-method-get-discount">
		<call class="com.axelor.apps.sale.web.SaleOrderLineController" method="getDiscount"/>
	</action-method>
	
	<action-method name="action-sale-order-line-method-reset-pack-line">
		<call class="com.axelor.apps.sale.web.SaleOrderLineController" method="resetPackLine"/>
	</action-method>

	<action-method name="action-sale-order-line-method-reset-pack-subline">
		<call class="com.axelor.apps.sale.web.SaleOrderLineController" method="resetPackSubLine"/>
	</action-method>

	<action-method name="action-sale-order-line-method-supplier-partner-domain" if-module="axelor-supplychain">
		<call class="com.axelor.apps.supplychain.web.SaleOrderLineController" method="supplierPartnerDomain"/>
	</action-method>

	<action-method name="action-sale-order-line-method-supplier-partner-default" if-module="axelor-supplychain">
		<call class="com.axelor.apps.supplychain.web.SaleOrderLineController" method="supplierPartnerDefault"/>
	</action-method>
	
	<action-method name="action-sale-order-line-method-check-qty">
		<call class="com.axelor.apps.sale.web.SaleOrderLineController" method="checkQty"/>
	</action-method>

	<action-method name="action-sale-order-line-method-get-tax-equiv">
		<call class="com.axelor.apps.sale.web.SaleOrderLineController" method="getTaxEquiv"/>
	</action-method>
	
	<action-method name="action-sale-order-line-method-onchange-price">
		<call class="com.axelor.apps.sale.web.SaleOrderLineController" method="updateInTaxPrice"/>
	</action-method>
	
	<action-method name="action-sale-order-line-method-onchange-intaxprice">
		<call class="com.axelor.apps.sale.web.SaleOrderLineController" method="updatePrice"/>
	</action-method>

  	<!-- ACTION ATTRS -->
    
    <action-attrs name="action-sale-order-line-attrs-hide-bill-of-material" if-module="axelor-production">
    	<attribute name="hidden" for="billOfMaterial" expr="eval: saleSupplySelect != 3 || product?.productTypeSelect == 'service' " if="__config__.app.isApp('production')"/>
    	<attribute name="hidden" for="customizeBOMBtn" expr="eval: saleSupplySelect != 3 || product?.productTypeSelect == 'service' " if="__config__.app.isApp('production')"/>
    </action-attrs>
    
	<action-attrs name="action-sale-order-line-attrs-bill-of-material-domain">
		<attribute name="domain" for="billOfMaterial" expr="eval: &quot;(self.product.id = ${product?.parentProduct?.id} OR self.product.id = ${product?.id}) AND self.defineSubBillOfMaterial = true AND self.personalized = false &quot;"/>
	</action-attrs>
	
	<action-attrs name="action-sale-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-sale-order-line-attrs-domain-product">
		<attribute name="domain" for="product" expr="self.isModel = false and (self.endDate = null or self.endDate &gt; :__date__) and self.sellable = true"/>
	</action-attrs>
	
  	<action-attrs name="action-sale-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()"/>
	</action-attrs>

	<action-attrs name="action-sale-order-line-attrs-type-select">
		<attribute name="selection-in" for="typeSelect" expr="eval:'[0,1]'" if="!(__config__.app.isApp('sale') &amp;&amp; __config__.app.getApp('sale').getProductPackMgt())"/>
		<attribute name="selection-in" for="typeSelect" expr="eval:'[0,1,2]'" if="__config__.app.isApp('sale') &amp;&amp; __config__.app.getApp('sale').getProductPackMgt()"/>
	</action-attrs>

	<action-attrs name="action-sale-order-line-compute-total-pack">
		<attribute name="value" for="totalPack" expr="eval:subLineList.collect{it->it.inTaxTotal}.sum()" if="typeSelect == 2 &amp;&amp; subLineList != null"/>
	</action-attrs>

	<action-attrs name="action-sale-order-line-attrs-set-company-currency">
		<attribute name="value" for="$companyCurrency" expr="eval:_parent?.company?.currency" if="_parent != null &amp;&amp; _parent._model == 'com.axelor.apps.sale.db.SaleOrder'" />
    	<attribute name="value" for="$companyCurrency" expr="eval:saleOrder?.company?.currency" if="saleOrder != null" />
	</action-attrs>

	<action-attrs name="action-sale-order-line-attrs-hidden-fields-for-client">
		<attribute name="hidden" for="toInvoice,allPanelTab,marginPanel" if="eval: __user__.group.isClient" expr="true"/>
	</action-attrs>

	<action-attrs name="action-sale-order-line-template-attrs-hidden-fields-for-client">
		<attribute name="hidden" for="allPanelTab" if="eval: __user__.group.isClient" expr="true"/>
	</action-attrs>

    <action-attrs name="action-sale-order-line-attrs-show-delivery-panel">
      <attribute name="hidden" for="deliveryPanel" expr="eval: !__user__.getActiveCompany().getSupplyChainConfig().getHasOutSmForStorableProduct()" if="product?.productTypeSelect == 'storable'"/>
      <attribute name="hidden" for="deliveryPanel" expr="eval: !__user__.getActiveCompany().getSupplyChainConfig().getHasOutSmForNonStorableProduct()" if="product?.productTypeSelect == 'service'"/>
    </action-attrs>

	<action-attrs name="action-sale-order-line-attrs-sub-line">
	  <attribute if="eval: __parent__.typeSelect == 2" name="value" expr="eval: true" for="isSubLine"/>
	</action-attrs>

	<action-attrs name="action-sale-order-line-attrs-fill-estimated-date">
		<attribute name="value" expr="eval: _parent?.deliveryDate" for="estimatedDelivDate" if="_parent != null &amp;&amp; _parent._model == 'com.axelor.apps.sale.db.SaleOrder' &amp;&amp; deliveryState &lt; 2"/>
	</action-attrs>

<!-- 	ACTION VIEW -->
	<action-view name="action-sale-order-line-view-stock-move-line" title="" model="com.axelor.apps.stock.db.StockMoveLine">
  		<view type="grid" name="stock-move-line-sale-order-line-grid"/>
		<view type="form" name="stock-move-line-all-form"/>
  		<domain>self.saleOrderLine.id = :id</domain>
  		<context name="id" expr="eval: id"/>
  	</action-view>

  	<action-view name="action-sale-order-line-view-team-tasks" title="Related tasks" model="com.axelor.team.db.TeamTask">
  		<view type="grid" name="team-task-grid"/>
  		<view type="form" name="team-task-form"/>
  		<domain>self.saleOrderLine = :id</domain>
  	</action-view>

</object-views>
