# edocument\_unece UNCL5189 / UNCL7161 code lists – correctness and EN 16931 validation

**URL:** <https://discuss.tryton.org/t/edocument-unece-uncl5189-uncl7161-code-lists-correctness-and-en-16931-validation/9419>\
**Category:** Developer\
**Tags:** edocument\
**Created:** [October 1, 2026, 11:51am UTC](https://discuss.tryton.org/t/edocument-unece-uncl5189-uncl7161-code-lists-correctness-and-en-16931-validation/9419 "2026-10-01T11:51:55Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![mariem](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@mariem](https://discuss.tryton.org/u/mariem)\
**Post date:** [October 1, 2026, 11:51am UTC](https://discuss.tryton.org/t/edocument-unece-uncl5189-uncl7161-code-lists-correctness-and-en-16931-validation/9419/1 "2026-10-01T11:51:55Z")

</div>

Hi,

I’m developing a Tryton module which using edocument\_unece module and I’m working around allowances and charges. I looked at the UNCL5189 and UNCL7161 code lists added to `edocument_unece` in 8.0 (`product.py`) and I have a few questions and observations. I’d like to know whether they are intended or worth fixing.

**What I understand of the design**

`product.template` gets two fields, `unece_allowance_charge_code` (UNCL5189) and `unece_special_service_code` (UNCL7161), both visible only for services. The field names match the UNECE data elements.

**Observations**

1. **Trailing spaces in UNCL7161 keys**  
Two-letter codes seem to be defined with a trailing space, e.g. `('AG ', ...)`, `('CB ', ...)`, `('DI ', ...)`, `('TX ', ...)`. If these values end up as-is in the UBL, they would not match the code list (EN 16931 rule BR-CL-20), since the code is `CB`, not `CB `.
2. **No distinction between allowance and charge**  
EN 16931 / Peppol require allowance reason codes to be in UNCL5189 (BR-CL-19, and Peppol restricts it to a subset: 41, 42, 60, 62–68, 70, 71, 88, 95, 100, 102–105), and charge reason codes to be in UNCL7161 (BR-CL-20). The full UNCL5189 list is exposed, and it also contains charge codes (e.g. 80 Packing charge, 85 Warehousing charge, 101 Carbon footprint charge). So a user can select a code that is valid in EDIFACT but rejected by Peppol validation. Would it make sense to filter the selection to only keep codes supported by Peppol ?
3. **UNCL7161: completeness**  
Some sequences have gaps (e.g. ADW, AEE), and the codes DAC and DAF–DAO (e.g. Assortment allowance, Dealer allowance, Multi-buy promotion) seem to be absent.I also wonder which directory version the list is meant to follow (EN 16931 refers to D.16B).
4. **Labels (cosmetic)**  
Some labels differ from the D.16B names (e.g. AA “Advertising allowance” vs “Advertising”, AAC “Modification costs” vs “Technical modification”). It has no effect on validation, but it may matter if the lists are meant to mirror the official ones.

**Questions**

- Is the goal to ship the full UN/EDIFACT lists, or the subsets used by EN 16931?
- Is the allowance/charge distinction handled somewhere else (e.g. in the UBL template) ?
- Would a patch (clean keys, missing codes, optional filtering/validation) be welcome ?

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [October 1, 2026, 12:25pm UTC](https://discuss.tryton.org/t/edocument-unece-uncl5189-uncl7161-code-lists-correctness-and-en-16931-validation/9419/2 "2026-10-01T12:25:42Z")

</div>

> [@mariem](#):
>
> 1. Two-letter codes seem to be defined with a trailing space

This is a copy/paste issue. I did not saw that some code had only 2 letters.

> [@mariem](#):
>
> 1. Would it make sense to filter the selection to only keep codes supported by Peppol ?

For me trying to replicate all the rules is time consuming for almost no benefit.  
I think it is simpler to let the user responsible of the setup because if an invoice is rejected by PEPPOL rules, they can still fix it.

> [@mariem](#):
>
> 1. I also wonder which directory version the list is meant to follow

It was probably the last version found on the UNECE website: [https://service.unece.org/trade/untdid/d98a/uncl/uncl7161.htm](https://service.unece.org/trade/untdid/d98a/uncl/uncl7161.htm)  
But it could be updated.

> [@mariem](#):
>
> 1. Some labels differ from the D.16B names

Yep. I do not know why PEPPOL does not always reuse th UNECE labels.  
As the module is about UNECE, we follow UNECE label.

---

<div class="post-metadata">

**Author:** ![mariem](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@mariem](https://discuss.tryton.org/u/mariem)\
**Post date:** [October 1, 2026, 12:37pm UTC](https://discuss.tryton.org/t/edocument-unece-uncl5189-uncl7161-code-lists-correctness-and-en-16931-validation/9419/3 "2026-10-01T12:37:24Z")

</div>

Thanks for the answers.

**Trailing spaces:** good to know. If some 8.0 databases already stored values like `'CB '`, a migration may be needed to strip them.

**Filtering:** that makes sense. I agree that `edocument_unece` shouldn’t replicate Peppol rules but maybe an option in configuration to restrict selection fields option to only peppol supported ones would be nice.

**Directory version:** this is where I think a change is needed. The Peppol and EN 16931 validation rules expect the D.16B version of UNCL5189 and UNCL7161. If the lists come from D.98A, codes added since then can’t be selected at all, which is different from a misconfiguration the user could fix.

**Labels:** understood, following the UNECE labels makes sense for this module.

I also have a question besides e-invoicing with Peppol, which use cases do you have in mind for the codes that Peppol doesn’t support? For example, the full UNCL5189 list contains many codes for banking commissions and fees (letters of credit, etc.), and they don’t seem relevant for invoices. Is the goal to provide the full UNECE lists for other EDI formats, or to use them in other documents ?

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [October 1, 2026, 12:51pm UTC](https://discuss.tryton.org/t/edocument-unece-uncl5189-uncl7161-code-lists-correctness-and-en-16931-validation/9419/4 "2026-10-01T12:51:15Z")

</div>

> [@mariem](#):
>
> The Peppol and EN 16931 validation rules expect the D.16B version of UNCL5189 and UNCL7161. If the lists come from D.98A, codes added since then can’t be selected at all, which is different from a misconfiguration the user could fix.

I guess D.16B was released in 2016 and D.98A in 1998.  
So I guess we should update the list using [https://unece.org/fileadmin/DAM/trade/untdid/d16b/tred/tred7161.htm](https://unece.org/fileadmin/DAM/trade/untdid/d16b/tred/tred7161.htm) and [https://unece.org/fileadmin/DAM/trade/untdid/d16b/tred/tred5189.htm](https://unece.org/fileadmin/DAM/trade/untdid/d16b/tred/tred5189.htm)

> [@mariem](#):
>
> Is the goal to provide the full UNECE lists for other EDI formats, or to use them in other documents ?

The goal is to be complete so any business can use it.  
So if a bank wants to manage its business with Tryton, they can reuse this module.

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [October 1, 2026, 12:54pm UTC](https://discuss.tryton.org/t/edocument-unece-uncl5189-uncl7161-code-lists-correctness-and-en-16931-validation/9419/5 "2026-10-01T12:54:32Z")

</div>

I created [UNCL7161 code contains trailing spaces (#15135) · Issues · Tryton / Tryton · GitLab](https://bugs.tryton.org/15135) to be included in 8.2 series.

For the update of the code lists to D.16B, we can not rush it to 8.2 so I left it to anyone…

---

<div class="post-metadata">

**Author:** ![mariem](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@mariem](https://discuss.tryton.org/u/mariem)\
**Post date:** [October 1, 2026, 2:02pm UTC](https://discuss.tryton.org/t/edocument-unece-uncl5189-uncl7161-code-lists-correctness-and-en-16931-validation/9419/6 "2026-10-01T14:02:44Z")

</div>

I found this UNCL7161 list on Peppol site which have more code (e.g. DAL, DAM, DAO, …) than the list you suggest for UNCL 7161: [Peppol BIS Billing 3.0 - May 2026 Release | Rules](https://docs.peppol.eu/poacc/billing/3.0/codelist/UNCL7161/)

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [October 1, 2026, 4:20pm UTC](https://discuss.tryton.org/t/edocument-unece-uncl5189-uncl7161-code-lists-correctness-and-en-16931-validation/9419/7 "2026-10-01T16:20:53Z")

</div>

The PEPPOL release note show that they have added additional codes: [Release notes for Peppol BIS Billing v3](https://docs.peppol.eu/poacc/billing/3.0/release-notes/#_changes_to_code_lists_and_validation_artefacts_13)

It seems that PEPPOL is based on an more updated list but still present as D.16B.

So I guess we could add them with a comment.

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [October 4, 2026, 7:38am UTC](https://discuss.tryton.org/t/edocument-unece-uncl5189-uncl7161-code-lists-correctness-and-en-16931-validation/9419/8 "2026-10-04T07:38:30Z")

</div>

I created [Update UNECE lists to version D.16B (#15145) · Issues · Tryton / Tryton · GitLab](https://bugs.tryton.org/15145)

---

<div class="post-metadata">

**Author:** ![mariem](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@mariem](https://discuss.tryton.org/u/mariem)\
**Post date:** [October 8, 2026, 11:57am UTC](https://discuss.tryton.org/t/edocument-unece-uncl5189-uncl7161-code-lists-correctness-and-en-16931-validation/9419/9 "2026-10-08T11:57:06Z")

</div>

Here are the code lists you need i think (the ones used by PEPPOL)

- UNCL 5189 (D24A)

[https://service.unece.org/trade/untdid/d24a/tred/tred5189.htm](https://service.unece.org/trade/untdid/d24a/tred/tred5189.htm)

- UNCL 7161 (D22B)

[https://service.unece.org/trade/untdid/d22b/tred/tred7161.htm](https://service.unece.org/trade/untdid/d22b/tred/tred7161.htm)

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [October 8, 2026, 12:30pm UTC](https://discuss.tryton.org/t/edocument-unece-uncl5189-uncl7161-code-lists-correctness-and-en-16931-validation/9419/10 "2026-10-08T12:30:59Z")

</div>

> [@mariem](#):
>
> - UNCL 5189 (D24A)
> 
> [https://service.unece.org/trade/untdid/d24a/tred/tred5189.htm](https://service.unece.org/trade/untdid/d24a/tred/tred5189.htm)

I do not think so it should be the D.16B version according to [Peppol BIS Billing 3.0 - May 2026 Release | Rules](https://docs.peppol.eu/poacc/billing/3.0/codelist/UNCL5189/)

> [@mariem](#):
>
> - UNCL 7161 (D22B)
> 
> [https://service.unece.org/trade/untdid/d22b/tred/tred7161.htm](https://service.unece.org/trade/untdid/d22b/tred/tred7161.htm)

And also D.16B version according to [Peppol BIS Billing 3.0 - May 2026 Release | Rules](https://docs.peppol.eu/poacc/billing/3.0/codelist/UNCL7161/)

---

<div class="post-metadata">

**Author:** ![mariem](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@mariem](https://discuss.tryton.org/u/mariem)\
**Post date:** [October 8, 2026, 12:36pm UTC](https://discuss.tryton.org/t/edocument-unece-uncl5189-uncl7161-code-lists-correctness-and-en-16931-validation/9419/11 "2026-10-08T12:36:15Z")

</div>

PEPPOL claiming D16B code lists but there not. Even if codes on the PEPPOL page are correct some of them are not in the UNCL D16B.

I found D24A and D22B version in french einvoicing reform documentation and since french rfe use peppol network to communicate between different approved platform, peppol must a least support them so that why I guessed PEPPOL used these version

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [October 8, 2026, 12:42pm UTC](https://discuss.tryton.org/t/edocument-unece-uncl5189-uncl7161-code-lists-correctness-and-en-16931-validation/9419/12 "2026-10-08T12:42:31Z")

</div>

> [@mariem](#):
>
> - 5189

This is very strange because D.16B is also repeated in [Peppol BIS Billing](https://docs.peppol.eu/poacc/billing/3.0/bis/#_allowance_reason_codes) and [Peppol BIS Billing](https://docs.peppol.eu/poacc/billing/3.0/bis/#_charge_reason_codes)  
But of D.24A and D.22B are the actual superset used by PEPPOL so I guess we should update to those versions.

---

<div class="post-metadata">

**Author:** ![mariem](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@mariem](https://discuss.tryton.org/u/mariem)\
**Post date:** [October 8, 2026, 12:59pm UTC](https://discuss.tryton.org/t/edocument-unece-uncl5189-uncl7161-code-lists-correctness-and-en-16931-validation/9419/13 "2026-10-08T12:59:23Z")

</div>

I think that if we see D16B on the PEPPOL site might be cause they reused their old documentation, added new codes and forgot to update the version number, idk.

thanks for ur advises

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [November 3, 2026, 3:45pm UTC](https://discuss.tryton.org/t/edocument-unece-uncl5189-uncl7161-code-lists-correctness-and-en-16931-validation/9419/14 "2026-11-03T15:45:36Z")

</div>

> **[Update UNECE lists to latest version (!3813) · Merge requests · Tryton /...](https://foss.heptapod.net/tryton/tryton/-/merge_requests/3813)**
>
> Closes #15145
