<?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">
	
	<action-view name="wizard-supplier-view" title="My space" model="com.axelor.apps.base.db.Wizard">
		<view type="form" name="wizard-supplier-form"/>
		<view-param name="show-toolbar" value="false"/>
	</action-view>
	
	<form name="wizard-supplier-form" title="My space" model="com.axelor.apps.base.db.Wizard">
		<panel name="mainPanel" hidden="true">
			<field name="id"/>
	    </panel>
	    <panel name="actionsPanel">
			<button name="myPurchaseOrderBtn"   title="My purchase orders" onClick="wizard-supplier-form-open-my-purchase-order" css="img-button client-img-menu" icon="img/128px/clientMenuSo_128px.jpg"/>
		    <button name="myRFQToCompleteBtn"   title="My R.F.Q. to complete" onClick="wizard-supplier-form-open-my-rfq-to-complete" css="img-button client-img-menu" icon="img/128px/clientMenuInvoice_128px.jpg"/>
			<button name="myRFQBtn"   title="My R.F.Q." onClick="wizard-supplier-form-open-my-rfq" css="img-button client-img-menu" icon="img/128px/clientMenuTicket_128px.jpg"/>
			<button name="myStockMoveBtn"   title="My deliveries" onClick="wizard-supplier-form-open-stock-move" css="img-button client-img-menu" icon="img/128px/clientMenuTicket_128px.jpg"/>
		</panel>
	</form>
	
	<action-view name="wizard-supplier-form-open-my-purchase-order" title="My purchase orders"
		model="com.axelor.apps.purchase.db.PurchaseOrder">
		<view type="grid" name="purchase-order-grid"/>
		<view type="form" name="purchase-order-form"/>
		<domain>self.supplierPartner = :_myPartner AND self.statusSelect in (2,3,4,5)</domain>
		<context name="_myPartner" expr="call:com.axelor.apps.base.service.user.UserService:getUserPartner()"/>
	</action-view>
	
	<action-view name="wizard-supplier-form-open-my-rfq-to-complete" title="My R.F.Q. to complete"
		model="com.axelor.apps.suppliermanagement.db.PurchaseOrderSupplierLine">
		<view type="grid" name="purchase-order-supplier-line-supplier-grid"/>
    	<view type="form" name="purchase-order-supplier-line-supplier-form"/>
		<domain>self.supplierPartner = :_myPartner AND self.stateSelect = 1</domain>
		<context name="_myPartner" expr="call:com.axelor.apps.base.service.user.UserService:getUserPartner()"/>
	</action-view>
	
	<action-view name="wizard-supplier-form-open-my-rfq" title="My R.F.Q."
		model="com.axelor.apps.suppliermanagement.db.PurchaseOrderSupplierLine">
		<view type="grid" name="purchase-order-supplier-line-supplier-grid"/>
    	<view type="form" name="purchase-order-supplier-line-supplier-form"/>
		<domain>self.supplierPartner = :_myPartner AND self.stateSelect in (2,3,4)</domain>
		<context name="_myPartner" expr="call:com.axelor.apps.base.service.user.UserService:getUserPartner()"/>
	</action-view>
	
	<action-view name="wizard-supplier-form-open-stock-move" title="My deliveries"
		model="com.axelor.apps.stock.db.StockMove">
		<view type="grid" name="stock-move-supplier-grid"/>
		<view type="form" name="stock-move-supplier-form"/>
		<domain>self.typeSelect = 3 AND self.partner = :_myPartner</domain>
		<context name="_myPartner" expr="call:com.axelor.apps.base.service.user.UserService:getUserPartner()"/>
	</action-view>	
	
	<grid name="stock-move-supplier-grid" title="Stock moves" model="com.axelor.apps.stock.db.StockMove" orderBy="-estimatedDate"  canNew="false" canDelete="false">
	  <field name="stockMoveSeq"/>
	  <field name="estimatedDate"/>
	  <field name="realDate"/>
	  <field name="toAddress"/>
	  <field name="company" if="__config__.app.getApp('base').getEnableMultiCompany()"/>
	  <field name="partner"/>
	  <field name="statusSelect"/>
  </grid>
    
	<form name="stock-move-supplier-form" title="Stock move" model="com.axelor.apps.stock.db.StockMove" canNew="false" canDelete="false" canCopy="false">
	  <panel name="statusPanel" >
	    <field name="statusSelect" readonly="true" widget="NavSelect" colSpan="12"/>
	  </panel>
	  <panel name="generalInfoPanel" readonly="true">
	    <panel name="detailsPanel" title="Stock move reference">
	      <field name="stockMoveSeq" colSpan="12"/>
	      <field name="name" colSpan="12"/>
	      <field name="company" widget="SuggestBox" form-view="company-form" colSpan="12"/>
	      <field name="partner" domain="self.isContact = false" form-view="partner-form" grid-view="partner-grid" colSpan="12"/>
	    </panel>
	    <panel name="stockMoveInformationsPanel" title="Stock move informations">
	      <field name="estimatedDate" colSpan="12"/>
	      <field name="realDate" title="Receipt date" colSpan="12"/>
	      <field name="fromAddress" showIf="typeSelect == 3" colSpan="12"/>
	    </panel>
	  </panel>
	  <panel-related name="stockMoveLineListPanel" field="stockMoveLineList" readonlyIf="company == null || fromStockLocation == null" colSpan="12" canNew="false" canRemove="false" form-view="stock-move-line-supplier-form" grid-view="stock-move-line-supplier-grid"/>
	</form>
    
    <grid name="stock-move-line-supplier-grid" title="Stock move lines" model="com.axelor.apps.stock.db.StockMoveLine" editable="true">
        <field name="product" readonly="true"/>
        <field name="shippedQty"/>
        <field name="unit" readonly="true"/>
		<field name="shippedDate"/>
    </grid>
    
    <form name="stock-move-line-supplier-form" title="Stock move line" model="com.axelor.apps.stock.db.StockMoveLine">
    	<panel name="mainPanel" >
	        <field name="product" readonly="true"/>
	        <field name="shippedQty"/>
	        <field name="unit" readonly="true"/>
			<field name="shippedDate"/>
		</panel>
    </form>
	
</object-views>