Add item capitalization feature

I’m looking into adding capitalization on items feature to my erpnext setup.

Basically, I want when I buy an item, for example 1000$. Later I service my item for example for 100$ and I paid it with payment entry. I want to capitalize that 100$ on my item value so in the inventory the value of the car will be 1100$ and I want it automatically.

What I’ve done is, I added a table to the item doctype that can store payment entries and fetch the total value of all services. I also edited the payment entry doctype to be able to use stock account instead of creditor, so when I buy a service it gets reflected on the stock account in the chart of accounts. I don’t want it to be an expense.

I’m stuck in the code, I want now whenever the item is edited to add a new payment, the valuation of that car gets updated to capitalize on them.

Scenario:

  1. bought a car for 1000$
  2. paid the auction fees for 100$
  3. add the acution fee payment entry to the car
  4. the car get re-evaluated to be 1100$
  5. cleaned the car in cleaning facility for 50$
  6. add the payment entry for the cleaning facility to the car
  7. the car gets re-evaluated to be worth 1150$ now

I’m looking into forking the project, create a branch, then add my features I don’t want to use client and server side scripts. I got lost in finding how the items are being valuated because I see sometimes it get fetched from the last purchase invoice, sometimes from the valuation int docfield in the item doctype. I’m kinda lost.

Have you tried checking the box “is fixed asset” to your item. With this you should
be able to add capital costs to the asset.