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

Invoice grand_total and base_grand_total differ while in the same currency #10255

Closed
AntonEvers opened this issue Jul 17, 2017 · 5 comments
Closed
Labels
bug report Component: Tax Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@AntonEvers
Copy link
Contributor

AntonEvers commented Jul 17, 2017

There are a lot of preconditions. I don't know which is the one that eventually causes the rounding difference, so bear with me.

Preconditions

  1. Magento CE develop branch
  2. Create a product with a price of 5.99
  3. Set the shipping cost of flat rate to 5.95 per order
  4. Assign shipping costs to the tax group 'taxable goods'
  5. Set the tax amount to 21%
  6. Create a cart rule that gives 1.50 discount per item
  7. Set the following tax config settings:
INSERT INTO `core_config_data` (`config_id`, `scope`, `scope_id`, `path`, `value`)
VALUES
	(88, 'default', 0, 'tax/classes/shipping_tax_class', '2'),
	(89, 'default', 0, 'tax/calculation/cross_border_trade_enabled', '0'),
	(90, 'default', 0, 'tax/defaults/postcode', NULL),
	(91, 'default', 0, 'tax/calculation/algorithm', 'TOTAL_BASE_CALCULATION'),
	(92, 'default', 0, 'tax/calculation/based_on', 'origin'),
	(93, 'default', 0, 'tax/notification/ignore_discount', '0'),
	(94, 'default', 0, 'tax/notification/ignore_price_display', '0'),
	(95, 'default', 0, 'tax/notification/ignore_apply_discount', '0'),
	(96, 'default', 0, 'tax/calculation/price_includes_tax', '1'),
	(97, 'default', 0, 'tax/calculation/shipping_includes_tax', '1'),
	(98, 'default', 0, 'tax/calculation/apply_after_discount', '1'),
	(99, 'default', 0, 'tax/calculation/discount_tax', '1'),
	(100, 'default', 0, 'tax/calculation/apply_tax_on', '0'),
	(101, 'default', 0, 'tax/defaults/country', 'NL'),
	(102, 'default', 0, 'tax/defaults/region', '0'),
	(103, 'default', 0, 'tax/display/type', '2'),
	(104, 'default', 0, 'tax/display/shipping', '2'),
	(105, 'default', 0, 'tax/cart_display/price', '2'),
	(106, 'default', 0, 'tax/cart_display/subtotal', '2'),
	(107, 'default', 0, 'tax/cart_display/shipping', '2'),
	(108, 'default', 0, 'tax/cart_display/grandtotal', '0'),
	(109, 'default', 0, 'tax/cart_display/full_summary', '0'),
	(110, 'default', 0, 'tax/cart_display/zero_tax', '1'),
	(111, 'default', 0, 'tax/sales_display/price', '2'),
	(112, 'default', 0, 'tax/sales_display/subtotal', '2'),
	(113, 'default', 0, 'tax/sales_display/shipping', '2'),
	(114, 'default', 0, 'tax/sales_display/grandtotal', '0'),
	(115, 'default', 0, 'tax/sales_display/full_summary', '0'),
	(116, 'default', 0, 'tax/sales_display/zero_tax', '1');
INSERT INTO `core_config_data` (`config_id`, `scope`, `scope_id`, `path`, `value`)
VALUES
	(117, 'default', 0, 'shipping/origin/country_id', 'NL'),
	(118, 'default', 0, 'shipping/origin/region_id', NULL),
	(119, 'default', 0, 'shipping/origin/postcode', NULL),
	(120, 'default', 0, 'shipping/origin/city', NULL),
	(121, 'default', 0, 'shipping/origin/street_line1', NULL),
	(122, 'default', 0, 'shipping/origin/street_line2', NULL);
INSERT INTO `core_config_data` (`config_id`, `scope`, `scope_id`, `path`, `value`)
VALUES
	(8, 'default', 0, 'currency/options/base', 'EUR'),
	(9, 'default', 0, 'currency/options/default', 'EUR'),
	(10, 'default', 0, 'currency/options/allow', 'EUR');

Steps to reproduce

  1. Buy the product of 5.99 with a quantity of 10
  2. Go to the cart. Verify that the subtotal is €59.90, the discount is -€15.00
  3. Click 'estimate shipping and tax' in the cart summary
  4. Pick the shipping method of €5.95. I had to select Netherlands as country.
  5. Verify that the shipping total is €5.95 and the tax total is €8.65
  6. Verify that the order total is €49.85
  7. Place the order
  8. Create an invoice
  9. SELECT order_id, grand_total, base_grand_total from sales_invoice WHERE order_id=5;

Expected result

  1. This outcome:
order_id grand_total base_grand_total
5 50.8500 50.8500

Actual result

  1. This outcome
order_id grand_total base_grand_total
5 50.8500 50.8600

The base_grand_total is one cent too high.

@AlexWorking
Copy link

Hello @ajpevers. I've been trying to reproduce this issue, but something seem to not stick with the preconditions and the steps to reproduce. After I fulfilled 6 steps of the preconditions the 7-th step is not executable. Some records can not be inserted due to duplicating entries on some keys. Also, please specify the 4-th and the 5-th steps of preconditions in more details.

@AntonEvers
Copy link
Contributor Author

AntonEvers commented Aug 4, 2017

Hello @AlexWorking

m2community_2017-08-04.sql.gz

I have attached a dump of fresh install with the config that was necessary. If you will look at the only invoice that is placed in the shop, you will see that the grand_total and the base_grand_total differ.

You can place new orders with this database dump in place and verify that this happens in the develop branch.

Basically the steps can now be simplified to:

  1. import the db dump and change the url keys etc to make it work (also create an admin account for yourself)
  2. place an order of 10 products
  3. create an invoice from the admin

@AntonEvers
Copy link
Contributor Author

Adding to this that the shipping_discount_tax_compensation_amount is -0.0100 and the base_shipping_discount_tax_compensation_amount is NULL

@AntonEvers
Copy link
Contributor Author

@AlexWorking found the bug. Fixed it.

magento-team pushed a commit that referenced this issue Aug 4, 2017
…amnt was empty from order onwards #10435

 - Merge Pull Request #10435 from ajpevers/magento2:issue-10255
 - Merged commits:
   1. a3599fe
magento-team pushed a commit that referenced this issue Aug 4, 2017
@magento-team
Copy link
Contributor

Internal ticket to track issue progress: MAGETWO-71360

@magento-team magento-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Component: Tax labels Aug 4, 2017
magento-team pushed a commit that referenced this issue Nov 7, 2017
…pensation_amnt was empty from order onwards #10435
magento-team pushed a commit that referenced this issue Nov 7, 2017
…pensation_amnt was empty from order onwards #10435
magento-team pushed a commit that referenced this issue Nov 7, 2017
[Plankton] Fixes
 - MAGETWO-80191: [2.2.x] - Fixes #10255: base_shipping_discount_tax_compensation_amnt was empty from order onwards #10435
 - MAGETWO-80203 [2.2.x]: - FIX for issue 9930 - Asymmetric Transaction Error with ElasticSearch #10610
 - MAGETWO-62981: Cannot save category position after drag&drop (second attempt)
 - MAGETWO-82339: Duplicate Shipment getting created
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Tax Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests

4 participants