block edit on Purchase lines when its confirmed

I need to stop allow editing on purchase lines when its confirmed (Purchase Order → Purchase → Confrim/Confirmation) , like when the order invoiced, the lines are not editable.

classes i looking into it:



Have a look at \Forms\PurchTable\Data Sources\PurchLine\Methods\active

allowEdit = purchTableForm.editLineAllowed(purchLine) || purchLine.editableInWorkflow();

here this code checks for user had permission to allow edit or not, when an active workflow is running.

But what i need is don’t allow to edit that purchase lines after the line is confirmed

You may need to add a check to see if the purchase order is confirmed in that method.

How would you confirm a purchase order line?

after creating a lines, Purchase TAB → Confirm/Confirmation

In purchTableForm.editLineAllowed(purchLine) method

return _purchLine.PurchStatus != PurchStatus::Invoiced

&& _purchLine.IsFinalized == NoYes::No

&& this.editHeaderAllowed();

how could i write my logic if i replace

_purchLine.PurchStatus != PurchStatus::Invoiced


_purchLine.PurchStatus == PurchStatus::None

working fine but the problem is new line also not getting edited for first time, i need to edit line untill i confirm that line

So you submit a PO to a supplier, it locks it, the supplier tells you they cannot deliver on that date or that quantity, what do you do?

As for the “confirm” of the line there is not one, when you exit off it if you give the user no ability to change it, or delete it, they will change this because it is so restrictive.

yes i’m disabling the rights from line level for every user, and gonna create a new roles/rights to edit this line separately

The purchStatus will not be updated when it is confirmed. You may need to check the approval status field.