# 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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user