Number sequence for purchase external packing slip number

Problem.

It is a common case that users don’t want to manually enter external packing slip number while posting purchase packing slip. In Microsoft Dynamics, we can set number sequence only for internal packing slips, but there is no possibility to use the same numbers for external documents or assign another number sequence for them. The objective was to hide „Packing receipt” field and use the same number sequence as for internal purchase packing slips.

Tool.

I used the same objects, which are responsible for taking user’s input in „Product receipt” field and making it packing slip identifier.

Step by step.

What we have to do is:

1. Hide „Product receipt” field from PurchEditLines form, so user will not be able to enter any value.
2. Disable „FormLetterId” value validation for packing slips while posting document as it is assigned later.
3. Use internal packing slip ID for external packing slip ID.

So…

1. PurchEditLinesForm_PackingSlip.num() method is indicating whether „Product receipt” field is visible or not. We have to modify it to return false.

2. After confirming that we want to post packing slip, system validates if packing slip ID is defined. We are setting it later, so let’s disable this validation, which happens in PurchSummary.checkFormLetterId() method.

3. No we can use our internal packing slip number sequence values for external document. Packing slip header is initialized before we get ID from sequence number, so we have to pick it earlier, and assign it to our external packing slip ID. The code in PurchPackingSlipJournalCreate class will look like this:

That’s all. „Product receipt” isn’t visible now and it is automatically taken from internal number sequence.

Dodaj komentarz