Creating new order is a process that apart from counting item values depends also on specific rules how to apply a tax to the order. Django-plans is designed with internationalization in mind, therefore the way that the module calculates additional tax for an order is highly customizable and depends in general on locale.
For each country, or more generally for each specific use, there need to be created specific taxation policy which defines what rate of tax is suitable for an order depending on issuer country and customer billing data.
Taxation policy can be defined as a simple class that should inherit from
plans.taxation.TaxationPolicy and provide
get_default_tax(vat_id, country_code) method. Having arguments like customer
Abstract class for defining taxation policies. Taxation policy is a way to handle what tax rate should be put on the order, this depends on user billing data.
Custom taxation policy should implement only method
get_default_tax(vat_id, country_code). This method should return a percent value of tax that should be added to the Order, or None if tax is not applicable.
Gets default tax rate. Simply returns
Gets issuers country. Simply returns
- tax_id – customer tax id
- country_code – customer country in ISO 2-letters format
Django-plans application is shipped with some default taxation policies. You can choose them via settings-PLANS_TAXATION_POLICY variable.
- This taxation policy should be correct for all EU countries. It uses following rules:
- if issuer country is not in EU - assert error,
- for buyer of the same country as issuer - return issuer tax,
- for company buyer from EU (with VIES) returns VAT n/a reverse charge,
- for non-company buyer from EU returns VAT from buyer country,
- for non-EU buyer return VAT n/a.
This taxation policy was updated at 1 Jan 2015 after new UE VAT regulations. You should also probably register in MOSS system.
This taxation policy requires
suds (we use suds-jurko) and
vatnumber python modules (connecting to VIES). If you want them automatically installed please remember to insert extra depedencies for pip:
$ pip install django-plans[eu]