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

Decimal quantities in an Invoice and Credit Memo #12986

Closed
alexlitvinenko opened this issue Jan 4, 2018 · 24 comments
Closed

Decimal quantities in an Invoice and Credit Memo #12986

alexlitvinenko opened this issue Jan 4, 2018 · 24 comments
Assignees
Labels
Event: dmcdindia Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release

Comments

@alexlitvinenko
Copy link

alexlitvinenko commented Jan 4, 2018

Magento allows to enter decimal number in a product quantity (Advanced Inventory -> Qty Uses Decimals = Yes). For example: 4.5 lbs.
Magento allows to buy product and specify decimal number with fractional part (e.g. 4.5).
Magento erase fractional part from product quantity during an invoice creation.
Magento incorrectly calculates subtotal for decimal quantities with fractional part during credit memo creation and correctly calculates tax and discount.

Preconditions

  1. Magento ver. 2.2.0
  2. Order example: image

Steps to reproduce for an Invoice

  1. Create sales order with a product with a decimal quantity (must include fractional part);
  2. Being on the sales order view page, press "Invoice" button;
  3. Check that "Qty to Invoice" = 20 but must be 20.5;
  4. Enter 20.5 and press "Update Qty's" button -> Fractional part was erased.

Steps to reproduce for a Credit Memo

  1. Create an Invoice;
  2. Being on the sales order view page, press "Credit Memo" button;
  3. Populate "Qty to Refund" with decimal with fractional part;
  4. Press "Update Qty's" button -> Subtotal was calculated for quantity=10.

Expected result for an Invoice

  1. I can invoice decimal number of products.

Actual result for an Invoice

  1. Fractional part was erased.

Expected result for a Credit Memo

  1. Subtotal should be 10.5 * 680 / 20 = 357
  2. Row Total should be 357 + 17.14 - 71.4 = 302.74

Actual result for a Credit Memo

  1. image
@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Jan 4, 2018
@hayatbiralem
Copy link

I have the same problem.
I hope you can help as soon as possible.
Thanks.

@hackrat
Copy link

hackrat commented Jan 7, 2018

#mm18in

@magento-engcom-team
Copy link
Contributor

@hackrat thank you for joining. Please accept team invitation here and self-assign the issue.

@hackrat hackrat self-assigned this Jan 7, 2018
@hackrat
Copy link

hackrat commented Jan 7, 2018

@alexlitvinenko , I have checked for order with fraction qty 21.5 and I am able to Invoice and even creditmemo using fraction qty 21.5
invoice_fraction_qty
creditmemo_fraction_qty

@hackrat hackrat removed their assignment Jan 7, 2018
@alexlitvinenko
Copy link
Author

@hackrat, try to reproduce it on a clean magento instance (with sample data) with default settings.

@KarlDeux
Copy link

KarlDeux commented Jan 22, 2018

@alexlitvinenko I was not able to reproduce the Invoice part but I was indeed able to reproduce the RMA's. It will appear as discounted but won't have any impact into the line value.

evidence2

Can you please verify if the invoice issue is still happening on latest 2.2-develop ?

@KarlDeux
Copy link

KarlDeux commented Jan 22, 2018

@alexlitvinenko forget what I said. I cannot reproduce the credit memo issue either :( can you please confirm if your issue is fully fixed with latest 2.2-develop ?

@alexlitvinenko
Copy link
Author

@KarlDeux I cannot reproduce the issue in magento 2.2-develop.

@KarlDeux
Copy link

@magento-engcom-team this looks already fixed in 2.2-develop.

@magento-engcom-team magento-engcom-team added the Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed label Feb 15, 2018
@magento-engcom-team
Copy link
Contributor

@alexlitvinenko, thank you for your report.
We've acknowledged the issue and added to our backlog.

@magento-engcom-team magento-engcom-team added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Fixed in 2.3.x The issue has been fixed in 2.3 release line and removed Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Feb 15, 2018
@pitangaweb
Copy link

I'm having the same issue here on Magento 2.2.2.

@hayatbiralem
Copy link

There is the same problem in 2.2.3.

@Top-CMS
Copy link

Top-CMS commented Apr 12, 2018

same problem in 2.2.3

@hayatbiralem
Copy link

hayatbiralem commented Apr 18, 2018

Hi everyone,

I had to solve this problem for my client immediatelly so I wrote a custom module for this. You can install it via composer.

Source files is in here.

Real problem is that somehow getIsQtyDecimal function in Magento\Sales\Model\Service\InvoiceService always return false, I don't know why.

When I just preference Magento\Sales\Model\Service\InvoiceService class and I modified prepareInvoice function and check decimal quantities manually. That solved the problem.

Credit Memos just fine in Magento 2.2.3 so I didn't worried about that.

I hope this module will be helped someone :)

@Top-CMS
Copy link

Top-CMS commented Apr 18, 2018

Hi hayatbiralem,

Thanks for creating this module....this fixed it for me on Magento 2.2.3.

You're my hero for today!

@sanjay-wagento
Copy link
Contributor

I am working on this at #dmcdindia

@sanjay-wagento
Copy link
Contributor

@magento-engcom-team , I cannot reproduce the issue in the latest 2.2-develop branch (Magento ver. 2.2.6-dev)

@vkublytskyi
Copy link

@sanjay-wagento Thank you for verifying this bug report

@Jilco
Copy link

Jilco commented Oct 30, 2019

Bug is back in 2.3.3! Never had the problem and after upgrade it's there....

@Jilco
Copy link

Jilco commented Nov 4, 2019

Any solutions yet?

@shamoon
Copy link

shamoon commented Nov 20, 2019

Magento you're kind of the worst. @Jilco Not the same bug but same effect, fix is here: #23943 (fix submitted Aug 8, still not released...)

@Jilco
Copy link

Jilco commented Nov 20, 2019

@nikonratm yes i found that already and changed it in Magento core, and it solved the problem

@mobeen-sarwar
Copy link

Here I'm facing the same problem in 2.4.1.

Any suggestions, please?

@niekappartmedia
Copy link

Also an issue still on 2.4.3-p1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Event: dmcdindia Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release
Projects
None yet
Development

No branches or pull requests