<?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="supplier-catalog-grid" title="Supplier Catalog" model="com.axelor.apps.purchase.db.SupplierCatalog">
        <field name="supplierPartner" form-view="partner-form" grid-view="partner-grid"/>
        <field name="productSupplierCode"/>
        <field name="productSupplierName"/>
		<field name="supplierPartner.currency" form-view="currency-form" grid-view="currency-grid"/>
        <field name="updateDate"/>
        <field name="minQty"/>
        <field name="price" x-scale="2" />
    </grid>

	<grid name="supplier-catalog-partner-grid" title="Supplier Catalog" model="com.axelor.apps.purchase.db.SupplierCatalog">
		<field name="product.code" width="120"/>
		<field name="product.name"/>
		<field name="productSupplierCode"/>
		<field name="productSupplierName"/>
		<field name="supplierPartner.currency" form-view="currency-form" grid-view="currency-grid"/>
		<field name="updateDate"/>
		<field name="minQty"/>
		<field name="price" x-scale="2" />
	</grid>
    
    <form name="supplier-catalog-form" title="Supplier Catalog" model="com.axelor.apps.purchase.db.SupplierCatalog"
		  onNew="action-supplier-catalog-attrs-init" onLoad="action-supplier-catalog-attrs-init" width="large">
    	<panel name="mainPanel" colSpan="12">
			<field name="supplierPartner" domain="self.isContact = false AND self.isSupplier = true" form-view="partner-form" grid-view="partner-grid"/>
			<field name="supplierPartner.currency" form-view="currency-form" grid-view="currency-grid"/>
			<field name="updateDate"/>
        	<field name="productSupplierCode"/>
        	<field name="productSupplierName"/>
        	<field name="minQty"/>
        	<field name="price"/>
       	</panel>
		<panel name="descriptionPanel" title="Description" colSpan="12">
			<field name="description" showTitle="false" colSpan="12"/>
		</panel>
		<panel-related name="shippingCoefListPanel" field="shippingCoefList" form-view="shipping-coef-form" grid-view="shipping-coef-grid"/>
    </form>

	<form name="supplier-catalog-partner-form" title="Supplier Catalog" model="com.axelor.apps.purchase.db.SupplierCatalog"
		  onNew="action-supplier-catalog-attrs-init" onLoad="action-supplier-catalog-attrs-init" width="large">
		<panel name="mainPanel" colSpan="12">
			<field name="product" form-view="product-form" grid-view="product-grid" onChange="action-supplier-catalog-attrs-update"/>
			<field name="supplierPartner.currency" form-view="currency-form" grid-view="currency-grid"/>
			<field name="updateDate"/>
			<field name="productSupplierCode"/>
			<field name="productSupplierName"/>
			<field name="minQty"/>
			<field name="price"/>
		</panel>
		<panel name="descriptionPanel" title="Description" colSpan="12">
			<field name="description" showTitle="false" colSpan="12"/>
		</panel>
		<panel-related name="shippingCoefListPanel" field="shippingCoefList" form-view="shipping-coef-form" grid-view="shipping-coef-grid"/>
	</form>

    <action-attrs name="action-supplier-catalog-attrs-init">
		<attribute name="scale" for="price" expr="eval: __config__.app.getNbDecimalDigitForUnitPrice()"/>
		<attribute name="hidden" for="shippingCoefList"
				   expr="eval: __parent__ &amp;&amp; !__parent__.defShipCoefByPartner" if="eval: __parent__._model == 'com.axelor.apps.base.db.Product'"/>
		<attribute name="hidden" for="shippingCoefList"
				   expr="eval: product &amp;&amp; !product.defShipCoefByPartner" if="eval: __parent__._model != 'com.axelor.apps.base.db.Product'"/>
	</action-attrs>

	<action-attrs name="action-supplier-catalog-attrs-update">
		<attribute name="hidden" for="shippingCoefList"
				   expr="eval: __parent__ &amp;&amp; !__parent__.defShipCoefByPartner" if="eval: __parent__._model == 'com.axelor.apps.base.db.Product'"/>
		<attribute name="hidden" for="shippingCoefList"
				   expr="eval: product &amp;&amp; !product.defShipCoefByPartner" if="eval: __parent__._model != 'com.axelor.apps.base.db.Product'"/>
	</action-attrs>
        
</object-views>