When adding line items with different currencies, the total price calculated in the line items overview does not take into account different currencies per line.
This happens in Purchase and in Sales orders. 10 yen are only about 8 cents - 20 USD is way off the correct value.
These were both created on the demo server. The total cost, calculated at the top of the order, is correct in both cases (10.08 USD)
One could argue that it makes no sense to use different currencies for each line item. I was trying to use this in a sales order to calculate a total cost of an idea, with parts purchased from different vendors, in different countries.
Regardless of which, it is currently possible to do this, and the sum is wrong. Something must be changed. Options:
InvenTree-Version: 0.10.0 dev
Django Version: 3.2.16
Commit Hash: e730b5c
Commit Date: 2023-01-10
Deployed using Docker: True
Active plugins: False
@miggland you can disable the total price column footer of the purchase/sale order tables by commenting out the footer-formatter code:
Lines 2373 to 2385 in e730b5c
Lines 2560 to 2572 in e730b5c
Lines 3885 to 3897 in e730b5c
Lines 4377 to 4388 in e730b5c
At first glance it seems to be doing some currency conversion... but not on individual rows. Will investigate if I can get it working
@miggland still looking to see if I'm able to fix it. Tried a few things, but I was to focused on adding data to the order lines. Having read the recommendation of @matmair, and re-thinking my strategy. I'm now thinking on adding two more fields to the api/order/so/ and api/order/po/ endpoints that represent the sub_total for the order lines and the extra lines.
Total price and sub-total prices will then all be shown in the base currency.
I've made a draft PR #4245 which is an initial solution to this problem, but it needs further refinement as for some reason the bootstrap table is firing the onPostFooter twice per table. So that's 4 times on page load.
|Issue Title||Created Date||Updated Date|