You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The accounts controller has specific functionality to unlink SOs from POs when the SO is cancelled. This seems counter-intuitive, consider the following use-case:
Create a PO from an SO. When the SO is no longer required and is cancelled, the user should be asked whether they also wish to cancel the PO, because they would need to inform the supplier. If the PO is not cancelled, it would still make sense that the PO remains linked to the SO for traceability;
One common reason for cancelling an SO is to amend it, therefore the link from the PO should also be amended to point to the new SO;
If the link is being removed to allow for easy SO deletion, I would argue deletion should be prevented and fail specifically because the link exists if the PO is still active. For many use-cases, a PO would not be linked to an SO anyway.
If on amending the Sales Order the PO Sales Order Item link no longer exists, it could be cleared but doesn't really matter because it is a data field and not a link field anyway.
frappe.msgprint(_("Purchase Orders {0} are un-linked").format("\n".join(linked_po)))
To further support this bug, it does not align with the operation for creating further POs from an amended SO. At several points the SO client code checks the item quantity against the ordered quantity, the ordered quantity having being set upon PO creation, but not cleared on SO cancellation to align with the link removal above:
This means if you cancel an SO, and also cancel the PO manually, you cannot create the PO from the SO again, because the ordered quantity is still set, and is read-only so cannot be cleared manually.
What should happen:
Upon SO cancellation, the user should be asked if the PO(s) should also be cancelled and prompted to inform their Supplier:
If yes, the SO & PO cancelled and the SO ordered quantity cleared
If no, the PO remains unchanged and the SO cancelled
Upon SO amend and the PO is still active:
SO links should be updated on the PO Items
Upon SO Item amend of line already linked from an active PO:
Amend of quantity: Warn the user that the PO will no longer accurately reflect the SO. An increase in SO quantity will be picked up by creation of further POs. A decrease will result in excess stock;
Line deletion: clear the PO Sales Order Item field. This could trigger a warning on the PO line: "Originating Sales Order line has been removed on amend"
Backport:
version-15
version-14
Module
accounts, buying, selling
Version
ERPNext - develop v16
Installation method
None
Relevant log output / Stack trace / Full Error Message.
No response
The text was updated successfully, but these errors were encountered:
Information about bug
The accounts controller has specific functionality to unlink SOs from POs when the SO is cancelled. This seems counter-intuitive, consider the following use-case:
erpnext/erpnext/controllers/accounts_controller.py
Lines 1640 to 1669 in ba9fb4e
To further support this bug, it does not align with the operation for creating further POs from an amended SO. At several points the SO client code checks the item quantity against the ordered quantity, the ordered quantity having being set upon PO creation, but not cleared on SO cancellation to align with the link removal above:
erpnext/erpnext/selling/doctype/sales_order/sales_order.js
Lines 1187 to 1190 in ba9fb4e
erpnext/erpnext/selling/doctype/sales_order/sales_order.js
Lines 1308 to 1322 in ba9fb4e
This means if you cancel an SO, and also cancel the PO manually, you cannot create the PO from the SO again, because the ordered quantity is still set, and is read-only so cannot be cleared manually.
What should happen:
Upon SO cancellation, the user should be asked if the PO(s) should also be cancelled and prompted to inform their Supplier:
Upon SO amend and the PO is still active:
Upon SO Item amend of line already linked from an active PO:
Backport:
version-15
version-14
Module
accounts, buying, selling
Version
ERPNext - develop v16
Installation method
None
Relevant log output / Stack trace / Full Error Message.
No response
The text was updated successfully, but these errors were encountered: