<?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="mrp-line-grid" model="com.axelor.apps.supplychain.db.MrpLine" title="Results" groupBy="product" sortable="false" orderBy="product.code,maturityDate,mrpLineType.typeSelect,mrpLineType.sequence,id">
        <hilite if="[5,8,9].indexOf($get('mrpLineType.elementSelect')) != -1" strong="true" color="info"/>
        <field name="product" hidden="true"/>
        <field name="mrpLineType" width="300"/>
        <field name="qty"/>
        <field name="maturityDate" width="100"/>
        <field name="cumulativeQty" css="bold"/>
        <field name="product.unit"/>
        <field name="minQty"/>
        <field name="stockLocation"/>
        <field name="maxLevel"/>
        <field name="relatedToSelectName"/>
        <field name="partner"/>
        <field name="proposalGenerated" hidden="true"/>
        <button name="generateProposalBtn" icon="fa-calendar" onClick="action-mrp-line-method-generate-proposal" readonlyIf="proposalGenerated || [5,8].indexOf($get('mrpLineType.elementSelect')) == -1"/>
        <field name="mrpLineType.elementSelect" hidden="true"/>
    </grid>
    
	<form name="mrp-line-form" model="com.axelor.apps.supplychain.db.MrpLine" title="Result">
	    <panel name="mainPanel">
	        <field name="product" readonly="true" canEdit="false"/>
	        <field name="mrpLineType" readonly="true"/>
        	<field name="qty" readonly="true"/>
        	<field name="maturityDate" readonly="true"/>
        	<field name="cumulativeQty" css="bold" readonly="true"/>
        	<field name="product.unit" readonly="true"/>
   	        <field name="minQty" readonly="true"/>
        	<field name="stockLocation" readonly="true"/>
        	<field name="maxLevel" readonly="true"/>
        	<field name="partner" showIf="partner"/>
   	        <button name="generateProposalBtn" title="Generate proposal" onClick="action-mrp-line-method-generate-proposal" showIf="!proposalGenerated &amp;&amp; [5,8].indexOf(mrpLineType.elementSelect) != -1"/>
            <field name="mrpLineType.elementSelect" hidden="true"/>
            <field name="mrpLineOriginList" colSpan="12" readonly="true">
                <editor x-viewer="true">
           			<field name="relatedToSelect" widget="RefSelect" x-related="relatedToSelectId" colSpan="12" showTitle="false"/>
                </editor>
            </field>
            <field name="proposalGenerated" hidden="true"/>
            <field name="proposalSelect" title="Proposal" widget="RefSelect" readonly="true" showIf="proposalGenerated"/>
	    </panel>
	 </form>
	 
	<action-method name="action-mrp-line-method-generate-proposal">
	    <call class="com.axelor.apps.supplychain.web.MrpLineController" method="generateProposal"/>
	</action-method>
	
</object-views>