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

Error on supplier order with multi-currency #30452

Open
altairis-benjamin opened this issue Jul 24, 2024 · 1 comment
Open

Error on supplier order with multi-currency #30452

altairis-benjamin opened this issue Jul 24, 2024 · 1 comment
Assignees
Labels
Bug This is a bug (something does not work as expected)

Comments

@altairis-benjamin
Copy link
Contributor

Bug

When we add a product with a buying price in another currency to a supplier order, the price in original currency is wrongly calcultated in most cases.

Dolibarr Version

18.0 and more (at least)

Environment PHP

7.4 and 8.1

Environment Database

MariaDB 11.4.2

Steps to reproduce the behavior and expected behavior

  • Create a new product from a supplier whose currency is not yours.

  • Add a price to this product in the supplier's currency with a conversion rate.

  • Add the product to an order to this supplier, with an important quantity.

  • Check the unit product in the supplier's currency, and the total amount in the same currency.

On my side, I created a supplier whose currency is Japan Yen with a rate defined at 167.
I created a product called Issue with a price with this supplier defined at 23000 Japan Yen (first and second screenshot)

I created a new supplier order in Japan Yen, and added this product with a quantity of 15000.

The result should be the following :

  • Unit price Excl. vat: 23000/167 = 137,724550898
  • Total price Excl. vat: 23000*15000/167 = 2065868,263473054
  • Unit price Excl. vat in original currency: 23000
  • Total price Excl.vat in original currency: 23000*15000 = 345000000

But, with rounded and current calculation method, we get respectively:
137,72455
2 065 868,25
22 999,99985
344 999 997,75

(Thrid screenshot)

It's a small difference here, but in fact it's due to the original currency price calculation: we start from the unit price in euros here, we multiply it by the conversion rate, and because of rounded values, we don't get the good result.
Because of that, supplier orders are wrong, and can't be used to send the order to the related supplier.

I just opened this issue because I wanted to give the possibility to discuss that point, but I'm ALREADY working on that point, so could you please assign myself to this issue while I can't do it on my own?

Attached files

image
image
image

@altairis-benjamin altairis-benjamin added the Bug This is a bug (something does not work as expected) label Jul 24, 2024
@altairis-benjamin
Copy link
Contributor Author

It looks like, to make it work correctly, we should return here the unit price devise.

For now, I absolutely ignore how I can get this value. Still working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is a bug (something does not work as expected)
Projects
None yet
Development

No branches or pull requests

1 participant