Change "Direct Unit Cost" in a released "Purchase Order"

That is not possible!

Do you really think so?

Yes?

So did I until a few hours ago when I got an email saying that it can be changed. Maybe some unexpected side-effect of some customization with G/L accounts we made?

First thing: lets see what it does in CRONUS. Create new "Purchase Order". Create new "G/L Account" line. Release the order. Change the "Direct Unit Cost". Error……….. I should have an error!……… Where is the error?…….. Why is there no error?……… Is it a standard CRONUS?…….Yes. Definitely nothing changed…….

Let’s start debugging.

Ahah, the call to function "TestStatusOpen". This should block it.

This is the code of function "TestStatusOpen" in 2009SP1W1:

IF StatusCheckSuspended THEN

EXIT;

GetPurchHeader;

IF Type IN [Type::Item,Type::"Fixed Asset"] THEN

PurchHeader.TESTFIELD(Status,PurchHeader.Status::Open);

Do you see why it doesn’t block?

Correct: If Type is different from Item and different from "Fixed Asset" it doesn’t test the status of the header! Commenting the <IF Type IN [Type::Item,Type::"Fixed Asset"] THEN> fixes the problem.

I have to admit that I didn’t check all functionality to see if it blocks something else somewhere else.

That’s dangerous. If a purchaser creates a line with a G/L Account, and he needs to go through the Approval process. After it is approved, he can still change the "Direct Unit Cost" without having to re-approve it again.

And we have the same problem (and same solution) with Sales Order lines.

Leave a Reply

You must be logged in to post a comment.

Create a new blog and join in the fun!