Jump to content

Tax-detail wrong on invoice


MediaFlux

Recommended Posts

Hi,

We're using PrestaShop v1.6.1.11 and our accountant noticed an error with the Tax-detail calculation on the invoices.

I created a screenshot with the problem and what the result should be.

post-966350-0-03747000-1487839197.jpg

Could this be due to a misconfiguration or is there an issue with PrestaShop's tax calculation?
I guess the former since i can't find any related issues, but then i wonder where the problem could be...

post-966350-0-03747000-1487839197_thumb.jpg

Link to comment
Share on other sites

Since 11u30 i'm trying to trace down the problem in the code and i think i finally found it.

In classes/order/Order.php

        foreach ($this->getCartRules() as $order_cart_rule) {
            if ($order_cart_rule['free_shipping'] && $free_shipping_tax === 0) {
                $free_shipping_tax = $this->total_shipping_tax_incl - $this->total_shipping_tax_excl;
                $order_discount_tax_excl -= $this->total_shipping_tax_excl;
                $expected_total_base += $this->total_shipping_tax_excl;
            }

            $cart_rule = new CartRule($order_cart_rule['id_cart_rule']);
            if ($cart_rule->reduction_product > 0) {
                if (empty($product_specific_discounts[$cart_rule->reduction_product])) {
                    $product_specific_discounts[$cart_rule->reduction_product] = 0;
                }

                $product_specific_discounts[$cart_rule->reduction_product] += $order_cart_rule['value_tax_excl'];
                $order_discount_tax_excl -= $order_cart_rule['value_tax_excl'];
            }
        }

On the 2nd line the condition $order_cart_rule['free_shipping'] always seems to be "0". Even if this cart rule actually is free shipping this is still "0" and that's why the rest of the tax calculation is wrong.

 

If i look in Price Rules > Cart Rules > Edit (ID: 32) > Tab Actions there the Free shipping is set to YES.
However in the database in ps_order_cart_rule at id_cart_rule: 32 the `free_shipping` is "0".

Seems to be a bug after all.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...