fix bugs Remove Sales Line when the sales Line already pick,pack,or invoiced on AX2012

i don’t know this is a bug come from our own customize or bugs originated from AX 2012.
anyway we have to fix this. Our client found this bug and requesting to add some validation and disable Remove Button on sales line when already pick.

so how i did this :

go to form SalesTable,
locate button Remove , and set AutoDeclaration to Yes, so we can call this button and disable or enable it via code.
look for method “active” in datasource SalesLine.

add this code below :

//AIFD fix bug remove button
    InventTrans     inventTransLoc;
    boolean         cekStatus;
    WMSOrderTrans   wmsOrderTrans;
  //END


    //add this code before return ret;
    cekStatus = true;
    //cek status dari inventtrans
    while select inventTransLoc   where inventTransLoc.InventTransOrigin==
    InventTransOrigin::findByInventTransId(SalesLine.InventTransId).RecId
    {
        if(inventTransLoc.StatusIssue != StatusIssue::OnOrder)
        {
            cekStatus = false;
            break;
        }
    }

    //cek status dari picking list
    while select wmsOrderTrans where   wmsOrderTrans.inventTransId==SalesLine.InventTransId
    {
        cekStatus = false;
        break;
    }


    if( salesLine.SalesStatus == SalesStatus::Backorder && cekStatus)
    {
        LineStripDelete.enabled(true);
    }
    else
    {
       LineStripDelete.enabled(false);
    }
    
    //END

voila… happy Daxing !!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s