Tax calculation issue

131 views
Skip to first unread message

Marco Badan

unread,
Nov 22, 2013, 10:42:11 AM11/22/13
to django...@googlegroups.com
Hi!

The tax calculation with a quantization step make a tax related issue more obvious:
( See this pull request 994 (I'm itbabu) https://github.com/tangentlabs/django-oscar/pull/994 )

total_tax_A = (2 * product1_price_excl_tax * fixed_tax_rate) + (product2_price_excl_tax * fixed_tax_rate) + (product3_price_excl_tax * fixed_tax_rate

and

total_tax_b = (2 * product1_price_excl_tax + product2_price_excl_tax + product3_price_excl_tax) * fixed_tax_rate 

tax_a and tax_b can be different if we work with Decimals.

In Italy (I suppose it's the same in the other countries???) the Law says that you should always go with the second option.
Also all the shipping charges should be included in this.

A more general example can be:
total_tax = ( 3*product1_price_excl_tax + product2_price_excl_tax + product3_price_ecl_tax + shipping_charges_for_p1_p2_p3_excl_tax) * fixed_tax_rate_a + (2*product4_price_ecl_tax + product5_price_excl_tax + shipping_charges_for_p4_p5_excl_tax) * fixed_tax_rate_b

Oscar atm goes with the first option. 
If we remove the quantization step this is less visibile but there is always the possibility that the total tax could be wrong. 

Has anyone run into this issue before?


marco

Maik Hoepfel

unread,
Nov 22, 2013, 10:54:46 AM11/22/13
to django...@googlegroups.com
Hi Marco,

you make an excellent point. To summarise, the issue is that one should
calculate tax based on the sum of product prices instead of calculating
tax per product.

I've created an issue to track this:
https://github.com/tangentlabs/django-oscar/issues/1015

Cheers,

Maik
> --
> https://github.com/tangentlabs/django-oscar
> http://django-oscar.readthedocs.org/en/latest/
> https://twitter.com/django_oscar
> ---
> You received this message because you are subscribed to the Google
> Groups "django-oscar" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-oscar...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-oscar.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-oscar/0f905289-e697-4b9b-88cb-be706ff94ce4%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Marco Badan

unread,
Nov 25, 2013, 10:00:43 AM11/25/13
to django...@googlegroups.com
Thanks Maik,
As quickfix i'm customizing some Basket properties (total_tax, total_incl_tax, total_incl_tax_excl_discounts) and my OrderTotalCalculator

Cheers
marco

Daniel Mahlberg

unread,
Jun 15, 2016, 3:20:44 PM6/15/16
to django-oscar
By now, this can be fixed by overriding the exponent property in the Strategy:

class MyCustomStrategy(FixedRateTax):
    exponent = D('0.001')
Reply all
Reply to author
Forward
0 new messages