<?xml version="1.0" encoding="UTF-8"?>
<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">
	
		<!-- SALES MAN DASHBOARD -->
		
	<dashboard title="Dashboard" name="sale.saleman.dashboard.sample"  >
		<dashlet action="dashlet.salesman.dashboard.orders" height="350" canSearch="true" colSpan="12"/>
		<dashlet action="dashlet.my.turnover.per.month" height="350" />
		<dashlet action="dashlet.salesman.dashboard.activities" canSearch="true" height="350" />
		<dashlet action="dashlet.salesman.dashboard.leads" canSearch="true" height="350" colSpan="12"/>
		<dashlet action="dashlet.salesman.dashboard.opportunities" canSearch="true" height="350" colSpan="12"/>
	</dashboard>
	
	<action-view name="dashlet.salesman.dashboard.orders" title="My Sales Orders" model="com.axelor.apps.sale.db.SaleOrder">
	  <view type="grid" name="sale-order-grid"/>
	  <view type="form" name="sale-order-form"/>
	  <domain>self.salemanUser = :__user__ and self.statusSelect in (1, 2) and self.company = :active_company</domain>
	  <context name="active_company" expr="call:com.axelor.apps.base.service.user.UserService:getUserActiveCompany()"/>
	</action-view>
	
	<action-view title="My Turnover per month" name="dashlet.my.turnover.per.month">
	  <view type="chart" name="chart.my.turnover.per.month"/>
	  <context name="todayDate" expr="eval:__config__.app.getTodayDate()" />
	</action-view>
	
	<action-view name="dashlet.salesman.dashboard.activities" title="My Today Activities"
		model="com.axelor.apps.crm.db.Event">
		<view type="grid" name="my-event-grid"/>
		<view type="form" name="event-form"/>
	    <domain>self.startDateTime between :_today and :_tomorrow and self.user =:__user__</domain>
	    <context name="_tomorrow" expr="eval: __date__.plusDays(1).atStartOfDay()"/>
	    <context name="_today" expr="eval: __date__.atStartOfDay()"/>
	</action-view>
	
	<action-view name="dashlet.salesman.dashboard.opportunities" title="My Opportunities" model="com.axelor.apps.crm.db.Opportunity">
	  <view type="grid" name="my-opportunity-grid"/>
	  <view type="form" name="opportunity-form"/>
	  <domain>self.user = :__user__</domain>
	</action-view>
	
	
	
	<!-- 	SALES MANAGER DASHBOARD -->
	
	<dashboard title="Dashboard" name="sale.manager.dashboard.sample"  >
        <dashlet action="dashlet.sales.manager.dashboard.sales.orders.per.salesman" height="350" colSpan="12"/>
		<dashlet action="dashlet.sales.turnover.ytd.vs.previous.years.by.month" height="350"/>
		<dashlet action="dashlet.sales.turnover.ytd.vs.past.year" height="350"/>  	
		<dashlet action="dashlet.sales.turnover.by.product.ytd.vs.lastyear" height="350"/>
		<dashlet action="dashlet.sales.turnover.ytd.vs.lastyear.by.family" height="350" />
		<dashlet action="dashlet.sales.turnover.by.family.ytd.vs.lastyear" height="350" />		
		<dashlet action="dashlet.sales.manager.dashboard.turnover.per.team" height="350"/>
		<dashlet action="dashlet.sales.manager.dashboard.sales.distribution.per.family" height="350" />
		<dashlet action="dashlet.sales.manager.dashboard.product.sales.per.category" height="350" />
		<dashlet action="dashlet.sales.manager.dashboard.sales.per.country" height="350" />
		<dashlet action="dashlet.turnover.sales.by.month.by.category" height="350" />    
   	    <dashlet action="dashlet.units.sold.on.cust.sales.by.category" height="350" />
   	    <dashlet action="dashlet.stockMove.nbr.delivery.by.country" height="350" if-module="axelor-stock"  if="__config__.app.isApp('stock')" />
   	    <dashlet action="dashlet.stockMoveLine.product.delivery.by.country" height="350" if-module="axelor-stock" if="__config__.app.isApp('stock')" />
   	    <dashlet action="dashlet.stockMoveLine.product.delivery.by.country.by.family" height="350" if-module="axelor-stock" if="__config__.app.isApp('stock')" />
   	    <dashlet action="dashlet.stockMove.deliveries.time.delay.in.nbr" height="350" if-module="axelor-stock" if="__config__.app.isApp('stock')" />
   	    <dashlet action="dashlet.stockMove.average.delivery.time.delay" height="350" if-module="axelor-stock" if="__config__.app.isApp('stock')" />
	</dashboard>
	
	<action-view title="Sales turnover comparison per month this year vs past years" model="com.axelor.apps.sale.db.SaleOrder" name="dashlet.sales.turnover.ytd.vs.previous.years.by.month">
	  <view type="chart" name="chart.sale.turnover.ytd.vs.previous.years.by.month"/>
	  <context name="todayDate" expr="eval:__config__.app.getTodayDate()"/>
	</action-view>

	<action-view name="dashlet.sales.turnover.ytd.vs.lastyear" title="Sales Turnover This year vs Last year" model="com.axelor.apps.sale.db.SaleOrder">
	    <view type="chart" name="chart.sale.turnover.ytd.vs.lastyear"/>

	</action-view>
	
	<action-view title="Sales turnover this year vs past years" model="com.axelor.apps.sale.db.SaleOrder" name="dashlet.sales.turnover.ytd.vs.past.year">
	  <view type="chart" name="chart.sale.turnover.ytd.vs.past.year"/>

	  <context name="todayDate" expr="eval:__config__.app.getTodayDate()"/>
	</action-view>
	
	<action-view name="dashlet.sales.turnover.by.product.ytd.vs.lastyear" title="Sales TurnOver by Product this year vs last year" model="com.axelor.apps.sale.db.SaleOrder">
	    <view type="chart" name="chart.sale.turnover.by.product.ytd.vs.lastyear"/>
	    <domain>self.company=:active_company</domain>
	    <context name="active_company" expr="call:com.axelor.apps.base.service.user.UserService:getUserActiveCompany()" />
	</action-view>
	
	<action-view name="dashlet.sales.turnover.ytd.vs.lastyear.by.family" title="Sales Turnover YTD vs Last year by Product Accounting Family" model="com.axelor.apps.sale.db.SaleOrderLine">
	  <view type="chart" name="chart.sale.turnover.ytd.vs.lastyear.by.family"/>
	  <domain>self.saleOrder.company=:active_company</domain>
	  <context name="active_company" expr="call:com.axelor.apps.base.service.user.UserService:getUserActiveCompany()" />
	</action-view>
	
	<action-view name="dashlet.sales.turnover.by.family.ytd.vs.lastyear" title="Product Accounting Family Sales Turnover this year vs last year" model="com.axelor.apps.sale.db.SaleOrderLine">
	  <view type="chart" name="chart.sale.turnover.by.family.ytd.vs.lastyear"/>
	  <domain>self.saleOrder.company=:active_company</domain>
	  <context name="active_company" expr="call:com.axelor.apps.base.service.user.UserService:getUserActiveCompany()" />
	</action-view>

	<action-view name="dashlet.sales.manager.dashboard.turnover.per.team" title="Turnover (excl. Tax) per team">
	  <view type="chart" name="chart.sale.manager.dashboard.turnover.per.team"/>
	  <context name="todayDate" expr="eval:__config__.app.getTodayDate()" />

	</action-view>
	
	<action-view name="dashlet.sales.manager.dashboard.sales.orders.per.salesman" title="Sales Orders per salesman">
	  <view type="chart" name="chart.sale.manager.dashboard.sales.orders.per.saleman"/>
	  <context name="todayDate" expr="eval:__config__.app.getTodayDate()" />

	</action-view>
	
	<action-view name="dashlet.sales.manager.dashboard.sales.distribution.per.family" title="Sales distribution per product accounting family">
	  <view type="chart" name="chart.sale.manager.dashboard.sale.distribution.per.family"/>
	  <context name="todayDate" expr="eval:__config__.app.getTodayDate()" />

	</action-view>
	
	<action-view name="dashlet.sales.manager.dashboard.product.sales.per.category" title="Sales distribution per product category">
	  <view type="chart" name="chart.sale.manager.dashboard.product.sale.per.category"/>
	  <context name="todayDate" expr="eval:__config__.app.getTodayDate()" />

	</action-view>
	
	<action-view name="dashlet.sales.manager.dashboard.sales.per.country" title="Sales per country">
	  <view type="chart" name="chart.sale.manager.dashboard.sale.per.country"/>
	  <context name="todayDate" expr="eval:__config__.app.getTodayDate()" />

	</action-view>
	
	<action-view name="dashlet.turnover.sales.by.month.by.category" title="Sales Turnover (Orders) by month by category">
	  <view type="chart" name="chart.turnover.sale.by.month.by.category"/>
	  <context name="todayDate" expr="eval:__config__.app.getTodayDate()" />

	</action-view>
	
	<action-view name="dashlet.units.sold.on.cust.sales.by.category" title="Nbr of Units sold (Orders) by category">
	  <view type="chart" name="chart.units.sold.on.cust.sale.by.category"/>
	  <context name="todayDate" expr="eval:__config__.app.getTodayDate()" />

	</action-view>
	
	<action-view name="dashlet.product.sale.turnover.last.12.month" title="Product sale turnover (Excl. Tax) last 12 month" model="com.axelor.apps.base.db.Product">
	  <view type="chart" name="chart.product.sale.turnover.last.12.month"/>
	  <context name="todayDate" expr="eval:__config__.app.getTodayDate()"/>
	  <context name="activeCompany" expr="call:com.axelor.apps.base.service.user.UserService:getUserActiveCompany()"/>
	</action-view>
	
	
	<!-- Sales DashBoard -->
	
	<dashboard name="sale.dashboard.view.1" title="Sales Details">
		<dashlet action="dashlet.salesman.dashboard.orders" canSearch="true" height="350" colSpan="12"/>
		<dashlet action="dashlet.my.turnover.per.month"  height="350" />
		<dashlet action="dashlet.sales.manager.dashboard.turnover.per.team"  height="350"/>
		<dashlet action="dashlet.sales.manager.dashboard.sales.orders.per.salesman"  height="350" />
		<dashlet action="dashlet.sales.manager.dashboard.sales.distribution.per.family"  height="350" />
		<dashlet action="dashlet.sales.manager.dashboard.product.sales.per.category"  height="350" />
		<dashlet action="dashlet.sales.manager.dashboard.sales.per.country"  height="350" />
		<dashlet action="dashlet.turnover.sales.by.month.by.category"  height="350" />
		<dashlet action="dashlet.units.sold.on.cust.sales.by.category"  height="350" />
	</dashboard>
	
	<dashboard name="sale.dashboard.view.2" title="Turnover Study">
		<dashlet action="dashlet.sales.turnover.by.product.ytd.vs.lastyear" canSearch="true" height="350" />
		<dashlet action="dashlet.sales.turnover.ytd.vs.previous.years.by.month" height="350"/>
		<dashlet action="dashlet.sales.turnover.ytd.vs.lastyear" canSearch="true" height="350" />
		<dashlet action="dashlet.sales.turnover.ytd.vs.past.year" height="350" />
		<dashlet action="dashlet.sales.turnover.ytd.vs.lastyear.by.family" canSearch="true" height="350" />
		<dashlet action="dashlet.sales.turnover.by.family.ytd.vs.lastyear" canSearch="true" height="350" />
		<dashlet action="dashlet.turnover.per.month.per.salesman.over.6mth" canSearch="true" height="350"/>
	    <dashlet action="dashlet.turnover.per.month.per.salesman.over.4mth" canSearch="true" height="350"/>
	    <dashlet action="dashlet.sales.turnover.per.customer.type" canSearch="true" height="350"/>
	    <dashlet action="dashlet.sales.turnover.per.customer.category" canSearch="true" height="350"/>
	    <dashlet action="dashlet.sales.turnover.per.customer.sector" canSearch="true" height="350"/>
	</dashboard>
	
    <action-view title="Turnover per month per saleman (6 month)" model="com.axelor.apps.sale.db.SaleOrder" name="dashlet.turnover.per.month.per.salesman.over.6mth">
		  <view type="chart" name="chart.turnover.per.month.per.saleman.over.6mth"/>
		  <context name="todayDate" expr="eval:__config__.app.getTodayDate()"/>
		  <context name="activeCompany" expr="call:com.axelor.apps.base.service.user.UserService:getUserActiveCompany()"/>
	</action-view>
	
	<action-view title="Turnover per month per saleman (4 month)" model="com.axelor.apps.sale.db.SaleOrder" name="dashlet.turnover.per.month.per.salesman.over.4mth">
		  <view type="chart" name="chart.turnover.per.month.per.saleman.over.4mth"/>
		  <context name="todayDate" expr="eval:__config__.app.getTodayDate()"/>
		  <context name="activeCompany" expr="call:com.axelor.apps.base.service.user.UserService:getUserActiveCompany()"/>
	</action-view>
	
	<action-view title="Turnover per customer type" model="com.axelor.apps.sale.db.SaleOrder" name="dashlet.sales.turnover.per.customer.type">
		  <view type="chart" name="chart.sale.turnover.per.customer.type"/>
		  <context name="todayDate" expr="eval:__config__.app.getTodayDate()"/>
		  <context name="activeCompany" expr="call:com.axelor.apps.base.service.user.UserService:getUserActiveCompany()"/>
	</action-view>

	<action-view title="Turnover per customer category" model="com.axelor.apps.sale.db.SaleOrder" name="dashlet.sales.turnover.per.customer.category">
		  <view type="chart" name="chart.sale.turnover.per.customer.category"/>
		  <context name="todayDate" expr="eval:__config__.app.getTodayDate()"/>
		  <context name="activeCompany" expr="call:com.axelor.apps.base.service.user.UserService:getUserActiveCompany()"/>
	</action-view>

	<action-view title="Turnover per customer sector" model="com.axelor.apps.sale.db.SaleOrder" name="dashlet.sales.turnover.per.customer.sector">
		  <view type="chart" name="chart.sale.turnover.per.customer.sector"/>
		  <context name="todayDate" expr="eval:__config__.app.getTodayDate()"/>
		  <context name="activeCompany" expr="call:com.axelor.apps.base.service.user.UserService:getUserActiveCompany()"/>
	</action-view>
		
	<!-- This portlet is called from Product-Category-Form Axelor Base -->
    <action-view title="Category sale turnover (Excl. Tax) per month" model="com.axelor.apps.base.db.Product" name="dashlet.category.sales.turnover.per.month">
		  <view type="chart" name="chart.category.sale.turnover.per.month"/>
		  <context name="todayDate" expr="eval:__config__.app.getTodayDate()"/>
		  <context name="activeCompany" expr="call:com.axelor.apps.base.service.user.UserService:getUserActiveCompany()"/>
	</action-view>
		
 	<!-- This Portlet is called in Partner-Form in axelor-base and axelor-account -->
	<action-view name="dashlet.customer.sales.lastYear.vs.ytd.by.family" title="Sales turnover comparison per month this year vs past years by accounting family" model="com.axelor.apps.sale.db.SaleOrderLine">
	  <view type="chart" name="chart.customer.sale.lastYear.vs.ytd.by.family"/>
	  <context name="activeCompany" expr="call:com.axelor.apps.base.service.user.UserService:getUserActiveCompany()"/>  
	  <context name="todayDate" expr="eval:__config__.app.getTodayDate()"/>
	</action-view>
		
		
</object-views>