<?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="raw-material-requirement-grid" title="Raw material requirement" model="com.axelor.apps.production.db.RawMaterialRequirement">
    <field name="code" width="120"/>
    <field name="name"/>
    <field name="company" if="__config__.app.getApp('base').getEnableMultiCompany()"/>
    <field name="duration"/>
  </grid>

  <form name="raw-material-requirement-form" title="Raw material requirement"
    model="com.axelor.apps.production.db.RawMaterialRequirement"
    onNew="action-raw-material-requirement-record-default">
    <panel name="mainPanel">
      <field name="code" readonly="true"/>
      <field name="name"/>
      <field name="company" required="true" canEdit="false"/>
      <field name="duration"/>
      <field name="showAllRequirements"/>
      <field name="showRequirementsByMO"/>
      <field name="stockLocationSet" colSpan="12"
        domain="self.company = :company AND self.typeSelect = 1"/>
    </panel>
    <panel name="actionsPanel" sidebar="true">
      <button name="exportBtn" title="Print" icon="fa-print"
        onClick="save,action-product-need-report-method-print"/>
    </panel>
  </form>

  <action-record name="action-raw-material-requirement-record-default" model="com.axelor.apps.production.db.RawMaterialRequirement">
    <field name="company" expr="eval:__user__.activeCompany" if="__user__.activeCompany != null"/>
    <field name="company" expr="eval:__repo__(Company).all().fetchOne()" if="__user__.activeCompany == null &amp;&amp; __repo__(Company).all().fetch().size == 1"/>
  </action-record>

  <action-method name="action-product-need-report-method-print">
    <call class="com.axelor.apps.production.web.RawMaterialRequirementController" method="print"/>
  </action-method>

</object-views>
