{ "info": { "author": "Invinet Sistemes", "author_email": "jtorrents@ingent.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "python-en16931\n==============\n\n.. image:: https://travis-ci.org/invinet/python-en16931.svg?branch=master\n :target: https://travis-ci.org/invinet/python-en16931\n\n.. image:: https://codecov.io/gh/invinet/python-en16931/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/invinet/python-en16931\n\nPython 3 package to read, write and manage the new `EN16931 Invoice format `_.\n\nThis `European Standard `_ establishes a semantic data model of the core elements of an electronic invoice. The semantic model includes only the essential information elements that an electronic invoice needs to ensure legal (including fiscal) compliance and to enable interoperability for cross-border, cross sector and for domestic trade.\n\nFeatures\n--------\n\nThis library allows you to:\n\n1. De-serialize an XML in EN16931 format to a python Invoice object.\n2. Serialize a python Invoice object to a valid XML representation.\n3. Validate an Invoice using `validex `_.\n4. Import an Invoice to `B2BRouter `_.\n\nUsage\n-----\n\nYou can import an invoice from an XML file:\n\n.. code-block:: python\n\n >>> from en16931 import Invoice\n >>> invoice = Invoice.from_xml('en16931/tests/files/invoice.xml')\n\nAnd use the API to access its internal values and entities:\n\n.. code-block:: python\n\n >>> invoice.issue_date\n datetime.datetime(2018, 6, 11, 0, 0)\n >>> invoice.seller_party\n \n >>> invoice.buyer_party\n \n >>> invoice.unique_taxes\n { Tax S: 0.21 , Tax S: 0.1 }\n >>> invoice.lines\n [,\n ,\n ]\n >>> invoice.tax_exclusive_amount\n 87.00\n >>> invoice.tax_amount()\n 16.62\n >>> invoice.tax_inclusive_amount\n 103.62\n >>> invoice.payable_amount\n 103.62\n\nIf you import an XML file, all relevant quantities are not computed; we\nuse the ones defined on the XML. You can check that the computed and\nimported quantities match by calling the relevant methods: \n\n.. code-block:: python\n\n >>> assert invoice.tax_exclusive_amount == invoice.subtotal()\n True\n >>> assert invoice.tax_inclusive_amount == invoice.total()\n True\n >>> assert invoice.payable_amount == invoice.total()\n True\n\nOr you can also build, step by step, an invoice:\n\n.. code-block:: python\n\n >>> from en16931 import Invoice\n >>> invoice = Invoice(invoice_id=\"2018-01\", currency=\"EUR\")\n >>> seller = Entity(name=\"Acme Inc.\", tax_scheme=\"VAT\",\n ... tax_scheme_id=\"ES34626691F\", country=\"ES\",\n ... party_legal_entity_id=\"ES34626691F\",\n ... registration_name=\"Acme INc.\", mail=\"acme@acme.io\",\n ... endpoint=\"ES76281415Y\", endpoint_scheme=\"ES:VAT\",\n ... address=\"easy street\", postalzone=\"08080\",\n ... city=\"Barcelona\")\n >>> buyer = Entity(name=\"Corp Inc.\", tax_scheme=\"VAT\",\n ... tax_scheme_id=\"ES76281415Y\", country=\"ES\",\n ... party_legal_entity_id=\"ES76281415Y\",\n ... registration_name=\"Corp INc.\", mail=\"corp@corp.io\",\n ... endpoint=\"ES76281415Y\", endpoint_scheme=\"ES:VAT\",\n ... address=\"busy street\", postalzone=\"08080\",\n ... city=\"Barcelona\")\n >>> invoice.buyer_party = buyer\n >>> invoice.seller_party = seller\n >>> invoice.due_date = \"2018-09-11\"\n >>> invoice.issue_date = \"2018-06-11\"\n >>> # lines\n >>> il1 = InvoiceLine(quantity=11, unit_code=\"EA\", price=2,\n ... item_name='test 1', currency=\"EUR\",\n ... tax_percent=0.21, tax_category=\"S\")\n >>> il2 = InvoiceLine(quantity=2, unit_code=\"EA\", price=25,\n ... item_name='test 2', currency=\"EUR\",\n ... tax_percent=0.21, tax_category=\"S\")\n >>> il3 = InvoiceLine(quantity=5, unit_code=\"EA\", price=3,\n ... item_name='test 3', currency=\"EUR\",\n ... tax_percent=0.1, tax_category=\"S\")\n >>> invoice.add_lines_from([il1, il2, il3])\n\nAnd serialize it to XML:\n\n.. code-block:: python\n\n >>> # As a string\n >>> xml = invoice.to_xml()\n >>> # Or save it directly to a file\n >>> invoice.save('example_invoice.xml')\n\nLimitations\n-----------\n\nThis is a proof of concept implementation and not all features defined\nin the EN16931 standard are implemented. But it is easy, in some cases\ntrivial, to implement them. The main not implemented features are:\n\n* CreditNotes are not supported.\n* File attachments are not supported.\n* Delivery information is not supported.\n* Only global charges and discounts are supported. Line discounts and\n charges are not supported.\n* Other potentially useful attributes (such as InvoicePeriod, BuyerReference,\n OrderReference, BillingReference, ContractDocumentReference, among others)\n are not implemented.\n\nIf you need a particular feature implemented, see the following section\nfor feature requests.\n\nBugs and Feature Requests\n-------------------------\n\nPlease report any bugs that you find `here `_.\nOr, even better, fork the repository on `GitHub `_\nand create a pull request (PR). We welcome all changes, big or small.\n\nLicense\n-------\n\nReleased under the Apache License Version 2.0 (see `LICENSE.txt`)::\n\n Copyright (C) 2018 Invinet Sistemes\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/invinet/python-en16931", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "en16931", "package_url": "https://pypi.org/project/en16931/", "platform": "", "project_url": "https://pypi.org/project/en16931/", "project_urls": { "Homepage": "https://github.com/invinet/python-en16931" }, "release_url": "https://pypi.org/project/en16931/0.1/", "requires_dist": null, "requires_python": "", "summary": "A Python 3 package to parse, generate and manage the EN16931 Invoice format", "version": "0.1" }, "last_serial": 4096721, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "9294e0a3d0e481b9730d9452a4fa65c5", "sha256": "a0fdbc9cc95f744ff7c2dfc3c0af8c271e536dbfa205e140c6a942f9108b8dde" }, "downloads": -1, "filename": "en16931-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "9294e0a3d0e481b9730d9452a4fa65c5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 28149, "upload_time": "2018-07-24T12:09:15", "url": "https://files.pythonhosted.org/packages/04/c3/d6ee9de00b28c9a484aca5f38b059238be6dbf99fcab88af9397d434faa5/en16931-0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eebcb2a9e639a92c5d056f580e08d2c6", "sha256": "4d87f51d88406a805c5d7b010ba8d6c13b07bdbd78336090f16f7c6bdd06d477" }, "downloads": -1, "filename": "en16931-0.1.tar.gz", "has_sig": false, "md5_digest": "eebcb2a9e639a92c5d056f580e08d2c6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21148, "upload_time": "2018-07-24T12:09:16", "url": "https://files.pythonhosted.org/packages/72/d5/45f1999652383c9d4c28f42e13022fb278c2f134e59a7750d1380ce8f1c0/en16931-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9294e0a3d0e481b9730d9452a4fa65c5", "sha256": "a0fdbc9cc95f744ff7c2dfc3c0af8c271e536dbfa205e140c6a942f9108b8dde" }, "downloads": -1, "filename": "en16931-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "9294e0a3d0e481b9730d9452a4fa65c5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 28149, "upload_time": "2018-07-24T12:09:15", "url": "https://files.pythonhosted.org/packages/04/c3/d6ee9de00b28c9a484aca5f38b059238be6dbf99fcab88af9397d434faa5/en16931-0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eebcb2a9e639a92c5d056f580e08d2c6", "sha256": "4d87f51d88406a805c5d7b010ba8d6c13b07bdbd78336090f16f7c6bdd06d477" }, "downloads": -1, "filename": "en16931-0.1.tar.gz", "has_sig": false, "md5_digest": "eebcb2a9e639a92c5d056f580e08d2c6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21148, "upload_time": "2018-07-24T12:09:16", "url": "https://files.pythonhosted.org/packages/72/d5/45f1999652383c9d4c28f42e13022fb278c2f134e59a7750d1380ce8f1c0/en16931-0.1.tar.gz" } ] }