The differential tax scheme is a margin tax scheme used in Germany for second hand goods and arts.

For example:

selling one product

- product selling price is 219
- product cost price is 100

The invoice total is than 219.

The tax base is: selling price - cost price - tax amount, i.e.

- tax base is 219 - 100 - 19 = 100
- tax amount is 19 (19%)

My solution is to add a new differential tax type. Compared to the already present tax types (percentage, fixed) the differential tax type requires knowledge of cost price to be processed/computed. The `Tax::_process_tax`

of a new module could be like:

```
def _process_tax(self, unit_list_price, unit_cost_price):
ret = {'differential_amount': Decimal(0)}
if self.type == 'differential':
margin = unit_list_price - unit_cost_price
if margin > Decimal(0):
base = margin / (1 + self.rate)
amount = margin - base
else:
base = Decimal(0)
amount = Decimal(0)
ret.update({
'base': base,
'amount': amount,
'differential_amount': amount,
'tax': self,
})
else:
ret.update(super(Tax, self)._process_tax(unit_list_price))
return ret
```

The real challenge is the `TaxableMixin`

[1]. The `TaxableMixin::taxable_lines`

should consist of tuples with four elements: `taxes`

, `unit_price`

, `quantity`

, * cost_price* and

`tax_date`

. The methods `TaxableMixin::_compute_tax_line`

and `TaxableMixin::_get_taxes`

[2] should be extended to handle the additional new attribute *within the*

`cost_price`

`taxable_lines`

and a new `differential_amount`

key from `_process_tax`

(see code snippet above).The challenge is to extend the `TaxableMixin`

and all modules using it like *account_invoice* or *sale* . As extending modules is a not an issue, thanks to trytons magic. Extending a Mixin is not a straight forward task. The only solutions Iâ€™m aware of are to fork tryrton or apply a monke patch on Mixin. The `Pool::register_mixin`

sounds promising, but it adds just a new Mixin to a model, as I understood.

Is there something Iâ€™ve missed? Is there any elegant solution to this Mixin issue?