Orders and Invoices now contains tax lines, and discount lines directly. Tax Lines are movements using "Tax" as resource, the quantity is the tax base, and the price is the tax rate. Tax Lines calculation is based on set membership implemented using categories.
Table of Contents
2 different categories are used:
For a given tax, the tax base will be the sum of total prices of all movements that are member of at least one of the categories that this tax apply to.
Tax Movements can also contribute themselves to other tax movements, this way we can implement complex tax scenarios, such as a tax based on another tax.
On a standard resource such as a Service or a Product, you define the Base Contribution, and all movements using this resource will be member of this base. Later, it will be possible to change this membership on the order movement, this means that user is able to handle exceptions to taxation rules (eg. the customer is tax-exempted ...) directly on the order line.
Tax Model Line defines how tax are calculated. They are defined inside Trade Conditions. Note that Trade conditions are now organised in a hierarchy, this means you don't have to have tax model lines in all your trade condition, but you can have a trade condition containing tax model lines and then create trade condition inheriting from this one.
A Tax Model Line defines what will be the ratio on tax lines, or the fixed amount, or a calculation script that should return the ratio (or fixed amount). Note that at the time of this writing, only tax ratio is implemented (svn r21054).
On a Tax Model Line, you define the list of categories on which the tax will apply to, this is "Base Application".
The Tax Line can also take part in the tax base for another tax, for this you set the "Base Contribution" on the Tax Model Line. Then the total price of the tax line will also be included in the tax base of the second tax line.
Tax Lines are created in the order / invoice when the trade condition containing tax model line is applied. Their price (which is the tax rate) is set then, and should not changes afterwards. Their quantities (which is the tax base, ie. the sum of movements total price) is updated by an interaction workflow on movements. Each time quantity, price or base_contribution is change on a movements, all tax lines are recalculated.
Discount and commissions are managed exactly the same way.