When attempting to unpost a record and remove its accounting data, the process consistently throws the error 'No Document Type for this register'. This issue occurs during execution of tests for the modules 'com.etendoerp.bulk.posting' and 'com.etendoerp.payment.removal'.
Steps to reproduce the error
Run any one of the ‘com.etendoerp.bulk.posting’ tests
Run any one of the ‘com.etendoerp.payment.removal’ tests
Expected behavior
The tests should pass.
The unposting process should successfully remove accounting data without the error, especially when the necessary document type is present or not required for the operation.
Affected Version
Core - Latest
Version number: 24.1.3
Solution Design
The function validateOpenPeriodsForDocBaseType lacks a check for when the variable docBaseTypesWithoutFacctAcct is empty. This oversight leads to the function always triggering the NoDocTypeForDocument exception, regardless of whether there is actually a missing document type. The proposed solution involves adding a condition to bypass the exception when docBaseTypesWithoutFacctAcct is empty.
Also, move the check up for it to be a proper early-return condition
Automatic Tests
Create automatic tests for this issue. The tests will consist of the following scenarios:
Post a register that has no Document Type. Expect failure
Unpost a register that has no Document Type. Expect failure
Error's description
When attempting to unpost a record and remove its accounting data, the process consistently throws the error 'No Document Type for this register'. This issue occurs during execution of tests for the modules 'com.etendoerp.bulk.posting' and 'com.etendoerp.payment.removal'.
Steps to reproduce the error
Expected behavior
The tests should pass.
The unposting process should successfully remove accounting data without the error, especially when the necessary document type is present or not required for the operation.
Affected Version
Core - Latest
Version number:
24.1.3
Solution Design
The function
validateOpenPeriodsForDocBaseType
lacks a check for when the variabledocBaseTypesWithoutFacctAcct
is empty. This oversight leads to the function always triggering theNoDocTypeForDocument
exception, regardless of whether there is actually a missing document type. The proposed solution involves adding a condition to bypass the exception whendocBaseTypesWithoutFacctAcct
is empty.Also, move the check up for it to be a proper early-return condition
Automatic Tests
Create automatic tests for this issue. The tests will consist of the following scenarios: