Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More
Configuration and utilities¶
This page contains code snippets (lines starting with >>>
), which are
being tested during our development workflow. The following
snippet initializes the demo project used throughout this page.
>>> from lino_book.projects.cosi1.startup import *
Plugin settings¶
The lino_xl.lib.peppol
plugin can be configured using the following
settings.
- lino_xl.lib.peppol.with_suppliers¶
Whether this site can register other organizations as Ibanity suppliers.
- lino_xl.lib.peppol.supplier_id¶
The identification code of this Lino site as an Ibanity supplier.
- lino_xl.lib.peppol.onboarding_date¶
Do not send any document having
entry_date
before this date.
The following three settings are filled automatically by the plugin at startup:
- lino_xl.lib.peppol.credentials¶
The Ibanity credentials to use on this Lino site for accessing the Ibanity API.
Must be specified in the form
"{client_id}:{client_secret}"
.
Model mixins¶
The peppol plugin defines two model mixins that add fields to
lino_xl.lib.accounting.Journal
and
lino_xl.lib.contacts.Partner
.
- class lino_xl.lib.peppol.PeppolPartner¶
- send_peppol¶
Whether sales invoices and credit notes to this partner should be sent via the Peppol network.
In the demo data this field is checked for some partners (a subset of those with a vat_id).
- peppol_id¶
How this partner identifies themselves in the Peppol network. This is a string of style schemaID:value, where schemaID refers to a EAS.
In the demo data this field is checked for journal SLS.
- endpoint_id¶
A property that returns an
EndpointID
instanceBelgian participants are registered with the Belgian company number, for which identifier scheme 0208 can be used. Optionally, the customer can be registered with their VAT number, for which identifier scheme 9925 can be used.
- class lino_xl.lib.peppol.PeppolJournal¶
- is_outbound¶
Whether vouchers of this journal should be sent via the Peppol network.
- last_sending¶
The date of the latest invoice in this journal that has been sent via Peppol.
What if a customer becomes send_peppol after the onboarding date, and had already invoices sent before the onboarding date? For example I activate my customer as a supplier, they start sending invoices to some of their customers. One month later, two customers of my customer onboard and ask to receive e-invoices. My customer also has sales invoices to these two customers during the first month, these invoices were sent outside of peppol via email. Right now Lino would send the invoices of the first month to these two customers.
Choicelists¶
- class lino_xl.lib.peppol.OutboundStates¶
>>> rt.show(peppol.OutboundStates, language="en")
======= ============== ==============
value name text
------- -------------- --------------
10 created Created
20 sending Sending
30 sent Sent
40 invalid Invalid
50 send_error Send-Error
51 acknowledged Acknowledged
52 accepted Accepted
53 rejected Rejected
======= ============== ==============
Or in German:
>>> rt.show(peppol.OutboundStates, language="de")
====== ============== ===============
Wert name Text
------ -------------- ---------------
10 created Erstellt
20 sending Sendung
30 sent Versendet
40 invalid Ungültig
50 send_error Versandfehler
51 acknowledged Acknowledged
52 accepted Zugesagt
53 rejected Abgesagt
====== ============== ===============
The following choicelist is not needed because we just store the text version in
OutboundDocument.error_message
.
>>> rt.show(peppol.OutboundErrors)
======= ========================= =========================
value name text
------- ------------------------- -------------------------
010 malicious Malicious
020 format Invalid format
030 xsd Invalid XML
040 schematron Invalid Schematron
050 identifiers Invalid identifiers
060 size Invalid size
070 invalid_type Invalid type
080 customer_not_registered Customer not registered
090 unsupported Type not supported
100 access_point Access Point issue
110 unspecified Unspecified error
======= ========================= =========================
Utilities¶
- class lino_xl.lib.peppol.EndpointID¶
A lightweight Python object to represent a Peppol endpoint identifier.
It can render the XML of the
Party / EndpointID
element of either AccountingSupplierParty or AccountingCustomerParty.- vat_id¶
- national_id¶
- country_code¶
- scheme¶
- as_xml()¶
Used in the
peppol-ubl.xml
template.
The Ibanity integration environment provides test receivers that we can use to test the sending of invoices for testing (more).
>>> from lino_xl.lib.peppol.utils import DEMO_RECEIVERS
>>> pprint(DEMO_RECEIVERS)
{'0106': '40559537',
'0190': '08405595370840559537',
'0208': '0840559537',
'9925': '0840559537',
'9930': 'DE654321',
'9938': 'LU654321',
'9944': 'NL840559537B01'}
>>> obj = contacts.Company.objects.get(name="Number One")
>>> print(obj.endpoint_id)
9925:0123456749
>>> print(obj.endpoint_id.as_xml())
<cbc:EndpointID schemeID="9925">BE0123456749</cbc:EndpointID>