New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[INVOICE] Bad display of Basic price and total tax when free gift tax rate is not the same as the products #24122
Comments
Hello @jcarloscid Could you please provide your PrestaShop and PHP versions. Please check and feedback. |
PS version is 1.7.7.1 I do no think my issue is really similar to #11722 The key to reproduce the issue is:
And the wrong thing is on the taxes breakdown, not on the discount. The discount as defined on the cart rule is applied correctly. Overall taxes are computed correctly (assuming that the discounted amount correspond to the price of the gift). but the taxes breakdown is wrong. I also have not seen any similar issue on EPIC #9703 |
Ping @PrestaShop/prestashop-core-developers friendly reminder ;-) |
Hello @jcarloscid, the team is currently under heavy workload because of the deep testing of PrestaShop 1.7.7.4 so you might need some patience before next answer 😉 |
We are experiencing the same problems with the conditions below, the tax breakdown is completely wrong. Still there is € 0,75 of 9% VAT on the invoice. Conditions to create this problem -->
PS version is 1.7.7.4 |
Hello @jcarloscid Thanks for your patience and sorry for the late response 🙏
Is those steps right? did I miss something? PS: related to #22951 Thanks! |
To be more precise:
I will try to test this in another PS 1.7.6.x version, but I can't guarantee I will find a suitable environment. I will let you know if I succeed. |
Hello @jcarloscid It seems everythink ok to me, see the attached screenshot below: But, in the invoice, I encounter an issue similar to this one #19790: I remember that I have seen this issue but I couldn't find it 😕
In my case, the total is correct: product_a (104.00) + shipping (12.10) = (116.10) ✔️ Thanks! |
Great!! You have reproduced the issue. As far as i have investigated the problem is on the data model. PrestaShop does not persist enough information in order to be able to rebuild this invoice correctly. Take a look at table |
Hello @jcarloscid Thanks to @khouloudbelguith we found the original issue #14646 Thanks! |
Well, I can´t tell this is the same case. I think that the key point on my issue is that we have TWO PRODUCT with a different tax rate each and one of them is A GIFT. Issue #14646 tells about a SINGLE PRODUCT with TWO taxes. But on May 20th you already reproduced my issue. The issue is on the invoice, not on the order, and it affects the tax breakdown (total tax is correct). Why I think you have all these three issues (#24122, #14646 and #19790)? My guess is that PrestaShop does not persists enough information on the database in order to correctly rebuild the tax breakdown, so it is prorating somewhat the taxes for the products using the total taxes and the (base price * quantity) of the products. |
Hello @jcarloscid Well then, thanks for your feedback! Please be aware that due to the high number of reported issues, some bugs might take a very long time to be resolved. If this issue is important to you and you cannot wait for it to be fixed on the project’s own time, we strongly suggest you consider hiring a specialist to help you. If you manage to get the problem fixed, then please contribute the fix back to the project as a Pull Request. Remember that the more people contribute, the better PrestaShop becomes for everyone. Thank you |
Perfect. Thanks. |
Hello, Is there no solution found? |
Describe the bug
PS-issue-sample.pdf
I am attaching the invoice of a sample order demonstrating the issue.
The total tax amount is correct, however the breakdown is incorrect.
Invoice data:
Products 4.000 % 0,80 €
21.000 % 0,46 €
Shipping 21.000 % 0,84 €
Expected behavior
Expected data:
Products 4.000 % 1,26 €
21.000 % 0,00 €
Shipping 21.000 % 0,84 €
Rationale:
The order contains a gift (via cart rule). The gross price of the product is 4,13€ and the tax rate is 21% for that product. As the net price of this product is 0€, taxes should be 0€ also. This is a mistake in the breakdown.
Shipping price is 4,00€ and tax rate is 21% (0,84€). This is computed correctly.
The non-gifted product has a price of 31,50€ and a tax rate of 4% (so taxes are 1,26€). This is a mistake in the breakdown as it should appear on the tax rate 4% line.
Tesis 1: As for tax calculation, the discount applies to the item with the lowest tax rate.
Item #1 base price: 4,13€ -- Tax rate 21% -- Taxes: 0,87€
Item #2 Base price: 31,50€ - 4,13 = 27,37€ -- Tax rate 4% -- Taxes: 1,09€
Tesis 1 does not explain tax breakdown.
Tesis 2: Discount is prorated among all products
Item #1 base price: 4,13€ -- Discount (4,13/35,63) * 4,13 = 0,48€ -- Net price: 3,65€ -- Tax rate 21% -- Taxes: 0,77€
Item #2 Base price: 31,50€ -- Discount (4,13/35,63) * 31,50 = 3,65€ -- Net price: 27,85 -- Tax rate 4% -- Taxes: 1,11€
Tesis 2 does not explain tax breakdown either.
Possible root cause:
My guess is that taxes are computed correctly for the order but are then incorrectly translated to the database.
In table ps_order_invoice, discounts only appear as a summary. There is no breakdown.
ps_order_invoice.total_discount_tax_excl
ps_order_invoice.total_discount_tax_incl
Ass far as I know there is no breakdown of discounts applied in any table.
Table ps_order_detail does not include information of the discount that applies to each order line.
Table ps_order_cart_rule does not include information of the tax rule that applies to the discount.
Table ps_order_detail_tax has inconsistent data. For the sample above unit amount and total amount should be equal, but:
Note that unit_amount column matches the calculations using tesis 2.
Note also that the sum of total_amount is correct according to the rationale (the discount is applied to the gifted product), but the breakdown by each product does not have any sense.
Steps to reproduce
Screenshots
Additional infos
The text was updated successfully, but these errors were encountered: