[Bug]: Deleting a Payment Term that's used on a Sales Order is allowed with no warning
Description:
Payment Terms are managed in Accounting under Configurations → Payment Terms. A Payment Term can be assigned to a Sales Order and is then shown on that order. Currently, a Payment Term can be deleted even while a Sales Order is actively using it, with no confirmation, warning, or block of any kind.
Steps to Reproduce:
- Go to Accounting → Configurations → Payment Terms and note an existing Payment Term.
- Open (or create) a Sales Order that uses that Payment Term, and confirm it as a Sales Order.
- Go back to Accounting → Configurations → Payment Terms and force delete that same Payment Term.
- Open the Sales Order from step 2 again and check the Payment Term field.
Actual Behaviour:
The Payment Term is deleted immediately with no warning that it is in use on a Sales Order. Going back to the Sales Order afterward shows the Payment Term field empty, even though the order previously had one selected.
Expected Behaviour:
The system should prevent deleting a Payment Term that is still referenced by a Sales Order (or any other document), the same way it already protects against deleting one used in accounting journal entries. It should either block the deletion with a clear message explaining it is in use, or require the user to reassign/clear the Payment Term on affected orders first.
Screen Recording:
https://github.com/user-attachments/assets/a4751484-058a-46b0-b416-476d038acc19
Source: aureuserp/aureuserp