/**
   * Set the default locator if this field is mandatory and we have a warehouse restriction.
   *
   * @since 3.1.4
   */
  private void setDefault_Locator_ID() {
    // teo_sarca, FR [ 1661546 ] Mandatory locator fields should use defaults

    if (!isMandatory() || m_mLocator == null) {
      return;
    }

    int M_Warehouse_ID = getOnly_Warehouse_ID();

    if (M_Warehouse_ID <= 0) {
      return;
    }

    MWarehouse wh = MWarehouse.get(Env.getCtx(), M_Warehouse_ID);

    if (wh == null || wh.get_ID() <= 0) {
      return;
    }

    MLocator loc = wh.getDefaultLocator();

    if (loc == null || loc.get_ID() <= 0) {
      return;
    }

    setValue(Integer.valueOf(loc.get_ID()));
  }