Wrong packing slip (delivery note) is printed for sales order

There is an error in standard SalesPackingSlipDP class:
    protected SalesPackingSlipHeaderTmp createReportData()
    {
        this.initializeReportData();

        custPackingSlipVersion  = custPackingSlipVersion::find(this.parmPackingSlipContract().parmRecordId());
        custPackingSlipJour     = custPackingSlipJour::findRecId(custPackingSlipVersion.custPackingSlipJour);
        
        return this.createSalesPackingSlip();
    }
Regardless of which table record RecId report contract contains CustPackingSlipVersion record is selected. Even though the same class contains the following method:
    protected CustPackingSlipJourRecId retrieveJournalRecId(SalesPackingSlipContract _salesPackingSlipContract)
    {
        RecId                       recId = _salesPackingSlipContract.parmRecordId();
        CustPackingSlipJourRecId    journalRecId;

        if (_salesPackingSlipContract.parmTableId() == tableNum(CustPackingSlipJour))
        {
            journalRecId = recId;
        }
        else if (_salesPackingSlipContract.parmTableId() == tableNum(CustPackingSlipVersion))
        {
            journalRecId = CustPackingSlipVersion::find(recId).CustPackingSlipJour;
        }
        
        return journalRecId;
    }
Which correctly handles both possible tables.
Unfortunately, it is not possible to resolve the issue with the Chain of Commands as both variables are declared as private:
    private CustPackingSlipVersion      custPackingSlipVersion;
    private CustPackingSlipJour         custPackingSlipJour;
And do not have real parm methods:
    [Hookable(false), Wrappable(false)]
    public CustPackingSlipVersion parmCustPackingSlipVersion()
    {
        return custPackingSlipVersion;
    }

    [Hookable(false), Wrappable(false)]
    public CustPackingSlipJour parmCustPackingSlipJour()
    {
        return custPackingSlipJour;
    }
Usually, RecId of both tables (custPackingSlipVersion, custPackingSlipJour) are equal, and therefore not many real installations are affected:
However, if there are processes, where several version records are possible for a single packing slip journal, then this issue will appear from the places where journals are used to print the packing slip.

 

Search

About

DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics AX.

Authors are allowed to set their own AdSense units.
Join us.

Blog Tags