/**
  * Model Change of a monitored Table. Called after PO.beforeSave/PO.beforeDelete when you called
  * addModelChange for the table
  *
  * @param po persistent object
  * @param type TYPE_
  * @return error message or null
  * @exception Exception if the recipient wishes the change to be not accept.
  */
 public String modelChange(PO po, int type) throws Exception {
   if (po.get_TableName().equals("C_Order") && type == TYPE_CHANGE) {
     @SuppressWarnings("unused")
     MOrder order = (MOrder) po;
     if (log.isLoggable(Level.INFO)) log.info(po.toString());
   }
   return null;
 } //	modelChange
  /**
   * Validate Document. Called as first step of DocAction.prepareIt when you called addDocValidate
   * for the table. Note that totals, etc. may not be correct.
   *
   * @param po persistent object
   * @param timing see TIMING_ constants
   * @return error message or null
   */
  public String docValidate(PO po, int timing) {
    if (log.isLoggable(Level.INFO)) log.info(po.get_TableName() + " Timing: " + timing);

    //	Ignore all after Complete events
    if (timing == TIMING_AFTER_COMPLETE) return null;

    if (timing == TIMING_BEFORE_PREPARE) {
      if (po.get_TableName().equals(MOrder.Table_Name)) {
        /**
         * Order Discount Example * MOrder order = (MOrder)po; String error = orderDiscount(order);
         * if (error != null) return error; /** Order Discount Example
         */
        if (log.isLoggable(Level.INFO)) log.info(po.toString());
      }
    }

    return null;
  } //	docValidate
  public String modelChange(PO po, int type) throws Exception {
    boolean IsLiberoEnabled = "Y".equals(Env.getContext(po.getCtx(), "#IsLiberoEnabled"));
    log.info(po.get_TableName() + " Type: " + type);
    if (!IsLiberoEnabled) return null;

    if (po instanceof MDDOrderLine
        && (TYPE_AFTER_CHANGE == type
            && po.is_ValueChanged(MDDOrderLine.COLUMNNAME_QtyDelivered))) {
      MDDOrderLine oline = (MDDOrderLine) po;
      Integer WM_InOutBoundLine_ID =
          (Integer) oline.get_Value(MWMInOutBoundLine.COLUMNNAME_WM_InOutBoundLine_ID);
      if (WM_InOutBoundLine_ID != null
          && WM_InOutBoundLine_ID.intValue() > 0
          && oline.getQtyOrdered().compareTo(oline.getQtyDelivered()) >= 0) {

        MWMInOutBoundLine obline =
            new MWMInOutBoundLine(oline.getCtx(), WM_InOutBoundLine_ID, oline.get_TrxName());
        obline.setPickedQty(oline.getQtyDelivered());
        obline.saveEx();
      }
    }
    return null;
  } //	modelChange
 public String docValidate(PO po, int timing) {
   log.info(po.get_TableName() + " Timing: " + timing);
   return null;
 } //	docValidate