Skip to content
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

Generating Invoice does recalculate tax but wrong!!! #31366

Closed
chequille opened this issue Dec 21, 2020 · 6 comments
Closed

Generating Invoice does recalculate tax but wrong!!! #31366

chequille opened this issue Dec 21, 2020 · 6 comments
Assignees
Labels
duplicate Issue: needs update Additional information is require, waiting for response

Comments

@chequille
Copy link

@srenon
Thanks for this. I made the changes manually. It is only one line to change :)
After chaning the page break when showing an invoice with zero tax did not happen again. So far so good.
But unfortunately, I found another bug regarding tax. It seems in 2.4.1 there are a lot of changes which did not solve problems but made new problems. I will show you what I found:

  1. Tax calculation is set in my system to "afterdiscount"
  2. I have a coupon for a special product at 49,-€ which reduces this amount 100% and no delivery costs are applied. Therefore, customer does not have to pay something. The invoice total and tax must be ZERO
  3. This working perfectly in my 2.3.5 store which is online

No, I show ou with some screenshots what happens in 2.4.1
I placed an order with a coupon code and the product I mentioned above.
Bank transfer payment, so invocie is not generated.
In the backend the order shows the following totals and tx amount which are correct, all zero !!!!
grafik

So far so good, but now I generate the invoice for this order and after doing so, we suddenly have a non zero total. Tax still says zero, but total is increased with 16% of 49,-€, definetely wrong!!!!!!! (16% is our current tax rate)
grafik

This is a very strange bug and I hope this will be solved very soon, as well with some patches, because waiting for the next release is probably to long.

Looking forward to hearing from you.

Best regards,
Chequille

@m2-assistant
Copy link

m2-assistant bot commented Dec 21, 2020

Hi @chequille. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@m2-assistant
Copy link

m2-assistant bot commented Dec 22, 2020

Hi @engcom-Bravo. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Bravo
Copy link
Contributor

engcom-Bravo commented Dec 22, 2020

Hello @chequille

Thank you for your report

We have rechecked the reported issue on 2.4.1 and on 2.4-develop versions
Here are the steps we performed:

  1. Apply Customer Tax is set to After Discount in Stores - Configuration - Sales - Tax - Calculation Settings
    after_discount
  2. Bank Transfer payment is Enabled and configured in Stores - Configuration - Sales - Payment Methods
  3. New Tax Rule added with tax Rate of 5% for all US users under Stores - Tax Rules
  4. Cart Price Rule created in Marketing - Cart Price Rule
  • With a Specific Coupon
    spec_cupon
  • 100% Product discount Applied under Actions (Also chcked Fixed amount discount of 99 and a product with price 99$)
    100percent
  1. From the Storefront, Sign In as a customer with US Address
  2. Add any product to Cart
    cart_withot_coupon
  3. Apply the previously created Coupon and assert that the discount is applied
    cart_with_coupon
  4. Place the order
  5. Go to Admin Panel Sales - Orders and View the previously created order
  6. Click Invoice
  7. Click Submit Invoice

*Actual Result
The order totals display 0
submit_invoice

Can you please provide more info, correct our steps, and explain the "coupon for a special product" ?

Thank you in advance

@engcom-Bravo engcom-Bravo added the Issue: needs update Additional information is require, waiting for response label Dec 22, 2020
@chequille
Copy link
Author

Hi,
must be honest, did not see, that htere is already another ticket saying exactly the same. It is ticket #30853
In this ticket, the error was reproduced and as well I do have it.
What I see in your picture above, you are looking at the order page not at the invoice page. Because on the order page everthing is still correct.
But look at the invoice page, there it is wrong as in my picture above.
Or just print the invoice to pdf and you will see there as well a not zero total.

Please try again, as I am not the only one facing this problem.
Thanks and best regards
Chequille

@chequille
Copy link
Author

Hi,
I made a change in Magento_Sales/Modul/Order/Invoice/Total/Tax.php and removed the $totalDiscountTaxCompensation and §baseTotalDiscountTaxCompoensation values in line 121 and 122 so it looks like below.

$invoice->setGrandTotal($invoice->getGrandTotal() + $totalTax);
$invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseTotalTax);

Doing so, my total value is 0 as it should.

Where is this tax compensation coming from and for what reason is it?

Do you have any explanation for it and what will be the solution?

Best regards,
Jürgen

@engcom-Bravo
Copy link
Contributor

@chequille Yes you are right, the #30853 it the same issue
So we are closing this as Duplicate
Please, follow all the updates in that issue

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issue: needs update Additional information is require, waiting for response
Projects
None yet
Development

No branches or pull requests

2 participants