# External ID mapping deduction and KOM

* adds support for external id usage on deduction creation for both ecoaccount and intervention
* adds support for external id usage on compensation's intervention reference
This commit is contained in:
2026-05-10 12:05:32 +02:00
parent 9632e59456
commit 3de6a905e1
2 changed files with 13 additions and 0 deletions

View File

@@ -62,6 +62,14 @@ class DeductionAPISerializerV1(AbstractModelAPISerializerV1,
if surface <= 0:
raise ValueError("Surface must be > 0 m²")
# Check if external identifiers need to be mapped onto internal ones
acc_ext_id = self._get_external_identifier(acc_id)
intervention_ext_id = self._get_external_identifier(intervention_id)
if acc_ext_id:
acc_id = acc_ext_id.internal_id
if intervention_ext_id:
intervention_id = intervention_ext_id.internal_id
acc = EcoAccount.objects.get(
id=acc_id,
deleted__isnull=True,