Invoice Line

class en16931.InvoiceLine(quantity=None, unit_code='EA', price=None, item_name=None, currency='EUR', tax_percent=None, line_extension_amount=None, tax_category=None, tax_name=None)

EN16931 InvoiceLine class.

Each Invoice has to have at least one invoice line in which the quantity and the price of the items is reflected.

You can initialize an InvoiceLine instance with all its attributes:

>>> il = InvoiceLine(quantity=11, unit_code="EA", price=2,
...                  item_name='test', currency="EUR",
...                  tax_percent=0.21, tax_category="S")

Or cou can do it step by step:

>>> il = InvoiceLine()
>>> il.quantity = 11
>>> il.price = 2
>>> il.item_name = 'test'
>>> il.tax_percent = 0.21
>>> il.tax_category = "S"

An InvoiceLine is only valid if it has quantity, price and tax defined:

>>> il.is_valid()
True
>>> new_line = InvoiceLine()
>>> new_line.is_valid()
False
__init__(quantity=None, unit_code='EA', price=None, item_name=None, currency='EUR', tax_percent=None, line_extension_amount=None, tax_category=None, tax_name=None)

Initialize an Invoice Line.

Parameters:
  • quantity (float or integer.) – The number of items of the line.

  • unit_code (string (optional).) – A unit code defining the nature of the quantities of the items of the line. It must be one of: ‘EA’: ‘units’, ‘HUR’: ‘hours’, ‘KGM’: ‘kilograms’, ‘LTR’: ‘litters’, ‘DAY’: ‘days’, ‘CS’: ‘boxes’.

  • price (string, integer, float) – The input must be a valid input for the Decimal class the Python Standard Library.

  • item_name (string (optional).) – Arbitrary name to define the item of the line.

  • currency (string.) – String representation of the ISO 4217 currency code.

  • tax_percent (float.) – The percentage of the Tax applied to the line. Can be 0.

  • tax_category (string.) – A string representing the category of the Tax. It must be one of ‘AE’, ‘L’, ‘M’, ‘E’, ‘S’, ‘Z’, ‘G’, ‘O’, or ‘K’.

  • tax_name (string.) – Arbitrary name to identify the Tax.

  • line_extension_amount (string, integer, float) – The input must be a valid input for the Decimal class the Python Standard Library. Computed unless the invoice is imported from an XML file.

Notes

An InvoiceLine is considered valid if and only if it has quantity, price and tax.

__repr__()

Return repr(self).

__weakref__

list of weak references to the object (if defined)

property currency

String representation of the ISO 4217 currency code.

Parameters:

currency_str (string) – String representation of the ISO 4217 currency code.

Raises:

KeyError – If the currency code is not a valid ISO 4217 code.:

Type:

Property

has_tax(tax)

Returns True if the line has this tax.

Parameters:

tax (Tax Object.) –

is_valid()

Returns True if the line is valid.

property item_name

The arbitrary name of the item of the line.

Parameters:

item_name (string (optional).) – Arbitrary name to define the item of the line.

property line_extension_amount

The LineExtensionAmount

Parameters:

line_extension_amount (string, integer, float) – The input must be a valid input for the Decimal class the Python Standard Library. Computed unless the invoice is imported from an XML file.

Type:

Property

property price

The price of one item.

Parameters:

price (string, integer, float) – The input must be a valid input for the Decimal class the Python Standard Library.

Type:

Property

property quantity

Quantity of items of the line.

Parameters:

quantity (float or integer.) – The number of items of the line.

Type:

Property

property tax

Returns a Tax object representing the taxes applied to the line.

property unit_code

The unit code defining the nature of the quantities.

Parameters:

unit_code (string.) – A unit code defining the nature of the quantities of the items of the line. It must be one of: ‘EA’: ‘units’, ‘HUR’: ‘hours’, ‘KGM’: ‘kilograms’, ‘LTR’: ‘litters’, ‘DAY’: ‘days’, ‘CS’: ‘boxes’.

Type:

property