<?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_6.1.xsd">

  <menuitem name="maintenance-root" title="Maintenance" order="-500"
    if="__config__.app.isApp('maintenance')" icon="fa-recycle" icon-background="olive"/>

  <menuitem name="maintenance-root-equipement-maintenances" parent="maintenance-root"
    title="Equipement maintenances" action="maintenance.root.equipement.maintenances" order="100"/>

  <action-view name="maintenance.root.equipement.maintenances"
    title="Equipement maintenances" model="com.axelor.apps.maintenance.db.EquipementMaintenance">
    <view type="cards" name="equipement-maintenance-cards"/>
    <view type="grid" name="equipement-maintenance-grid"/>
    <view type="form" name="equipement-maintenance-form"/>
  </action-view>

  <menuitem name="maintenance-root-current-maintenance-requests" parent="maintenance-root"
    title="Current requests" action="maintenance.root.current.maintenance.requests" order="200"/>

  <action-view name="maintenance.root.current.maintenance.requests"
    title="Current requests" model="com.axelor.apps.maintenance.db.MaintenanceRequest">
    <view type="kanban" name="maintenance-request-kanban"/>
    <view type="calendar" name="maintenance-request-calendar-per-user"/>
    <view type="grid" name="maintenance-request-grid"/>
    <view type="form" name="maintenance-request-form"/>
    <view-param name="kanban-hide-columns" value="2,3"/>
    <domain>self.statusSelect in (0,1)</domain>
    <context name="_todayDate" expr="eval:__config__.date"/>
  </action-view>

  <menuitem name="maintenance-root-my-maintenance-requests" parent="maintenance-root"
    title="My Maintenance requests" action="maintenance.root.my.maintenance.requests" order="300"/>

  <action-view name="maintenance.root.my.maintenance.requests"
    title="My Maintenance requests" model="com.axelor.apps.maintenance.db.MaintenanceRequest">
    <view type="kanban" name="maintenance-request-kanban"/>
    <view type="calendar" name="maintenance-request-calendar-per-user"/>
    <view type="form" name="maintenance-request-form"/>
    <view-param name="kanban-hide-columns" value="2,3"/>
    <domain>self.statusSelect in (0,1) and self.assignedTo = :__user__</domain>
    <context name="_todayDate" expr="eval:__config__.date"/>
  </action-view>

  <menuitem name="maintenance-root-machine-unavailable" parent="maintenance-root"
    title="Machines unavailable" action="maintenance.root.machine.unavailable" order="400"/>

  <action-view name="maintenance.root.machine.unavailable" title="Machines unavailable"
    model="com.axelor.apps.maintenance.db.MaintenanceRequest">
    <view type="calendar" name="maintenance-request-calendar-per-machine"/>
    <domain>self.statusSelect in (0,1,2) and self.equipementMaintenance.machine is not null</domain>
    <context name="_todayDate" expr="eval:__config__.date"/>
  </action-view>

  <menuitem name="maintenance-root-maintenance-request-history" parent="maintenance-root"
    title="Request history" action="maintenance.root.maintenance.request.history" order="500"/>

  <action-view name="maintenance.root.maintenance.request.history"
    title="Request history" model="com.axelor.apps.maintenance.db.MaintenanceRequest">
    <view type="grid" name="maintenance-request-grid"/>
    <view type="kanban" name="maintenance-request-kanban"/>
    <view type="calendar" name="maintenance-request-calendar-per-user"/>
    <view type="form" name="maintenance-request-form"/>
    <context name="_todayDate" expr="eval:__config__.date"/>
  </action-view>

  <menuitem name="maintenance-root-manuf-order" parent="maintenance-root" order="600"
    title="Maintenance order" action="maintenance.manufacturing.root.manuf.order"/>

  <action-view name="maintenance.manufacturing.root.manuf.order"
    title="Maintenance orders" model="com.axelor.apps.production.db.ManufOrder">
    <view type="grid" name="maintenance-manuf-order-grid"/>
    <view type="form" name="maintenance-manuf-order-form"/>
    <view-param name="search-filters" value="manuf-order-filters"/>
    <domain>self.typeSelect = 3</domain>
    <context name="_todayDateTime" expr="eval:__config__.app.getTodayDateTime()"/>
    <context name="_maintenance" expr="eval: true"/>
  </action-view>

  <menuitem name="maintenance-root-config" parent="maintenance-root" title="Configuration"
    order="700"/>

  <menuitem name="maintenance-root-config-maintenance-category"
    parent="maintenance-root-config" title="Maintenance Category"
    action="maintenance.root.config.maintenance.category" order="100"/>

  <action-view name="maintenance.root.config.maintenance.category"
    title="Maintenance Category" model="com.axelor.apps.maintenance.db.MaintenanceCategory">
    <view type="grid" name="maintenance-category-grid"/>
    <view type="form" name="maintenance-category-form"/>
  </action-view>

  <menuitem name="maintenance-root-config-machines" parent="maintenance-root-config"
    order="200" title="Machines" action="maintenance.root.config.machines"/>

  <action-view name="maintenance.root.config.machines" title="Machines"
    model="com.axelor.apps.production.db.Machine">
    <view type="grid" name="machine-grid"/>
    <view type="form" name="maintenance-machine-form"/>
  </action-view>

  <menuitem name="maintenance-root-config-prod-process" parent="maintenance-root-config"
    order="300" title="Production processes" action="maintenance.manufacturing.root.prod.process"/>

  <action-view name="maintenance.manufacturing.root.prod.process"
    title="Production processes" model="com.axelor.apps.production.db.ProdProcess">
    <view type="grid" name="maintenance-prod-process-grid"/>
    <view type="form" name="maintenance-prod-process-form"/>
    <domain>self.typeSelect = 3</domain>
    <context name="typeSelect" expr="eval: 3"/>
    <context name="_maintenance" expr="eval: true"/>
  </action-view>

  <menuitem name="maintenance-root-config-bill-of-material"
    parent="maintenance-root-config" order="400" title="Bills of materials"
    action="maintenance.manufacturing.root.bill.of.material"/>

  <action-view name="maintenance.manufacturing.root.bill.of.material"
    title="Bills of materials" model="com.axelor.apps.production.db.BillOfMaterial">
    <view type="grid" name="maintenance-bill-of-material-grid"/>
    <view type="form" name="maintenance-bill-of-material-form"/>
    <domain>self.defineSubBillOfMaterial = true AND self.personalized = false AND self.typeSelect =
      3</domain>
    <context name="_maintenance" expr="eval: true"/>
  </action-view>

  <action-view id="addons.maintenance.manufacturing.root.bill.of.material"
    name="manufacturing.root.bill.of.material" title="Bills of materials"
    model="com.axelor.apps.production.db.BillOfMaterial">
    <view type="grid" name="bill-of-material-grid"/>
    <view type="form" name="bill-of-material-form"/>
    <domain>self.defineSubBillOfMaterial = true AND self.personalized = false AND self.typeSelect =
      1</domain>
  </action-view>

  <action-view id="addons.maintenance.manufacturing.root.prod.process"
    name="manufacturing.root.prod.process" title="Production processes"
    model="com.axelor.apps.production.db.ProdProcess">
    <view type="grid" name="prod-process-grid"/>
    <view type="form" name="prod-process-form"/>
    <domain>self.typeSelect = 1</domain>
  </action-view>

  <action-view id="maintenance.manufacturing.root.general.bill.of.material"
    name="manufacturing.root.general.bill.of.material" title="General BoM"
    model="com.axelor.apps.production.db.BillOfMaterial">
    <view type="grid" name="bill-of-material-grid"/>
    <view type="form" name="bill-of-material-form"/>
    <view-param name="search-filters" value="bill-of-material-filters"/>
    <domain><![CDATA[
      self.defineSubBillOfMaterial = true
      AND self.personalized = false
      AND self.typeSelect != 3
    ]]></domain>
  </action-view>

</object-views>
