Module
l10n_it_vat_settlement_communication
Describe the bug
Saving a comunicazione.liquidazione raises
ValidationError: Communication with identifier N already exists
even when no record with that identifier is visible to the user. The
error fires on single-company databases and with a single company
selected in the top-right switcher.
Two defects combine.
1. _get_identificativo default
The default returns count(records) + 1. Row counting does not produce
unique values. A deleted row, a gap, or an out-of-order import lets
the default land on an identifier that already exists.
2. _check_identificativo constraint scope
The Python constraint searches without a company_id filter
To Reproduce
Affected versions: 18.0 (module 18.0.1.0.1)
Steps to reproduce the behavior:
- Create three comunicazione.liquidazione records on one company.
The default assigns identifiers 1, 2, 3.
- Delete the record with identifier 2.
- Create a new record. The default returns 2 + 1 = 3, the save
fails with
ValidationError: Communication with identifier 3 already exists.
Expected behavior
The default returns a value that does not collide with an existing
record. The uniqueness check matches records on the same company only.
Module
l10n_it_vat_settlement_communicationDescribe the bug
Saving a
comunicazione.liquidazioneraisesValidationError: Communication with identifier N already existseven when no record with that identifier is visible to the user. The
error fires on single-company databases and with a single company
selected in the top-right switcher.
Two defects combine.
1.
_get_identificativodefaultThe default returns
count(records) + 1. Row counting does not produceunique values. A deleted row, a gap, or an out-of-order import lets
the default land on an identifier that already exists.
2.
_check_identificativoconstraint scopeThe Python constraint searches without a
company_idfilterTo Reproduce
Affected versions: 18.0 (module 18.0.1.0.1)
Steps to reproduce the behavior:
The default assigns identifiers 1, 2, 3.
fails with
ValidationError: Communication with identifier 3 already exists.
Expected behavior
The default returns a value that does not collide with an existing
record. The uniqueness check matches records on the same company only.