ERPNext Conference 2019* Blog

Vehicle Expenses Report: Report charts Fuel Price whereas it should show Total Fuel Expenditure



Vehicle Expenses Report charts Fuel Price whereas it should show Total Fuel Expenditure.
I guess that makes sense…

It looks like adding a computed column in the SQL query and processing this column in the Python code will make the report meaningful.


I think the intent of the column was to capture the total expense of fuel per log. Maybe just a label change of the field to “Fuel Expense” on the doctype may be simpler as users do not always enter the unit price on the log. They just enter totals.

However, if you wish to change it to capture unit price then in that case there should be a calculation on the doctype JS also to reflect the same.


You may be right but the explanation and the business scenario is not clear. If there is a knowledge on the quantity of the fuel consumed and the recording is precise to the km/miles on the clock, I think the it is up to the company to make sense of it. This way they can both use the Fuel Price as a report or prefer to have Fuel Expense reported depending on the recording style.

If there will be any calculations, I do not see any point in placing this in the .js where the .py file contained all the calculations.

Fuel is one of the most expensive items in Turkey so the HR/Admin departments have a tighter grip.


In the case where the user enters total fuel expense in the field which is named as Fuel Price on the Vehicle Log doctype, eg: quantity 50 and fuel price as 100, the report will show Fuel Expense as 5000, which maybe correct in your business case but not if the user is using the field to enter the total fuel expense. In that case the fuel expense is only 100.

The calculation on the report is implicit as it assumes that the user enters per unit rate on the doctype Vehicle Log

Hence I suggested that you may add the calculation on the Vehicle Log doctype as well so that the user knows that they need to enter per unit price.


Keeping both fields and allowing the user to choose between Price and Expense is a great feature IMHO.

The user will have the option to Set Chart obviously for both scenarios.

Semantically, where Expense is the total of Repair/Service cost should be coupled with Fuel Expense meaning the total fuel cost including taxes. The users who are reporting to Fuel Price will still be able to get it wereas others may refer to the Fuel Expense.

What do you think?