示例#1
0
  @Override
  public String modelChange(final PO po, final int type) throws Exception {
    if (type == TYPE_BEFORE_CHANGE) {
      final I_C_Order order = InterfaceWrapperHelper.create(po, I_C_Order.class);

      if (po.is_ValueChanged(I_C_Invoice_Candidate.COLUMNNAME_DateOrdered)) {
        final IOrderPA orderPA = Services.get(IOrderPA.class);
        final IInvoiceCandDAO invoiceCandDB = Services.get(IInvoiceCandDAO.class);

        for (final I_C_OrderLine ol : orderPA.retrieveOrderLines(order, I_C_OrderLine.class)) {
          for (final I_C_Invoice_Candidate icOfOl : invoiceCandDB.retrieveReferencing(ol)) {
            if (icOfOl.isToClear()) {
              // If the column was updatable, we would have to
              // *check if new and old term are the same
              // *check if ICAs need update, creation or deletion and do it;
              // *check which dataEntries' ActualQty needs update and make sure that they are not
              // yet
              // completed
              // *check is isToClear needs update;
              throw new AdempiereException(
                  Env.getAD_Language(po.getCtx()),
                  MSG_ORDER_DATE_ORDERED_CHANGE_FORBIDDEN_1P,
                  new Object[] {ol.getLine()});
            }
          }
        }
      }
    }
    return null;
  }
示例#2
0
 private Collection<MAcctSchema> getAcctSchema(PO po) {
   int AD_Org_ID = po.getAD_Org_ID();
   MAcctSchema[] ass = MAcctSchema.getClientAcctSchema(po.getCtx(), po.getAD_Client_ID());
   ArrayList<MAcctSchema> list = new ArrayList<MAcctSchema>(ass.length);
   for (MAcctSchema as : ass) {
     if (!as.isSkipOrg(AD_Org_ID)) list.add(as);
   }
   return list;
 }
  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