Skip to main content

Auto Depreciation Plugin

Auto depreciation is a beancount plugin to deal with fixed assets depreciation. In our daily life, we may buy some valuable goods like cars, phones, furniture, etc. All these transactions are preferred to be documented as transfer instead of expenses, otherwise, you cannot evaluate your daily expenses properly. This plugin can generate depreciation transactions automatically.

GitHub Workflow Status Codecov PyPI PyPI - License PyPI - Python Version GitHub last commit

Installing

pip install auto-depreciation

Configuration

The parameters passed to the plugin are:

  • assets: Fixed assets account.
  • expenses: Depreciation expenses account.
  • method: Depreciation method.

Parameter default values are as follows:

plugin "auto_depreciation.depreciation" "{
    'assets':'Assets:Wealth:Fixed-Assets',
    'expenses':'Expenses:Property-Expenses:Depreciation',
    'method':'parabola',
}"

Usage

Xiaoming is a young man. One day he bought a car and paid in cash. We assume that the original value of that car is 100,000 CNY and it will scrap after 10 years. The residual value is still 1,000 CNY.

He can use this plugin like this:

!!! example

```
plugin "auto_depreciation.depreciation"

2020-03-01 commodity CARS
    name: "cars"
    assets-class: "fixed assets"

2020-03-31 * ""
    Assets:Cash                     -100000.00 CNY
    Assets:Wealth:Fixed-Assets           1 CARS {100000.00 CNY, "BMW"}
        useful_life: "10y"
        residual_value: 1000
```

where we use metadata attached in the posting to pass residual value and useful life to plugin.

useful_life is the compulsory item and y represent years while m represent months.

residual_value is optional and by default 0.

!!! note

`residual_value` is rounded to 2 decimal places.

!!! example

```
2020-03-31 * "Example"
    Assets:Cash              -600.00 CNY
    Assets:Wealth:Fixed-Assets        1 LENS {600.00 CNY, "Nikon"}
        useful_life: "3m"
        residual_value: 200
```

The code above is equal to

```
2020-03-31 * "Example"
    Assets:Cash                     -600.00 CNY
    Assets:Wealth:Fixed-Assets        1 LENS {600.00 CNY, 2020-03-31, "Nikon"}
        useful_life: "3m"
        residual_value: 200

2020-04-30 * "Example-auto_depreciation:Nikon"
    Assets:Wealth:Fixed-Assets              -1 LENS {600.00 CNY, 2020-03-31, "Nikon"}
    Assets:Wealth:Fixed-Assets               1 LENS {379.74 CNY, 2020-04-30, "Nikon"}
    Expenses:Property-Expenses:Depreciation    220.26 CNY

2020-05-31 * "Example-auto_depreciation:Nikon"
    Assets:Wealth:Fixed-Assets              -1 LENS {379.74 CNY, 2020-04-30, "Nikon"}
    Assets:Wealth:Fixed-Assets               1 LENS {243.47 CNY, 2020-05-31, "Nikon"}
    Expenses:Property-Expenses:Depreciation    136.27 CNY

2020-06-30 * "Example-auto_depreciation:Nikon"
    Assets:Wealth:Fixed-Assets              -1 LENS {243.47 CNY, 2020-05-31, "Nikon"}
    Assets:Wealth:Fixed-Assets               1 LENS {200 CNY, 2020-06-30, "Nikon"}
    Expenses:Property-Expenses:Depreciation     43.47 CNY
```

If the amount of fixed assets is greater than 1, all will be depreciated like this:

!!! example

```
2020-03-31 * "Example"
    Assets:Cash                    -1200.00 CNY
    Assets:Wealth:Fixed-Assets        2 LENS {600.00 CNY, 2020-03-31, "Nikon"}
        useful_life: "3m"
        residual_value: 200

2020-04-30 * "Example-auto_depreciation:Nikon"
    Assets:Wealth:Fixed-Assets              -2 LENS {600.00 CNY, 2020-03-31, "Nikon"}
    Assets:Wealth:Fixed-Assets               2 LENS {379.74 CNY, 2020-04-30, "Nikon"}
    Expenses:Property-Expenses:Depreciation    440.52 CNY

...
```

Metadata

Release files for auto-depreciation 3.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for auto-depreciation 3.1.1
File Size Uploaded
auto-depreciation-3.1.1.tar.gz 18.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for auto-depreciation 3.1.1
File Interpreter ABI Platform
auto_depreciation-3.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 36.7 kB

Release files / auto-depreciation-3.1.1.tar.gz

Download URL auto-depreciation-3.1.1.tar.gz
Size 18.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0f4ec89f36937cbb390d28eda29e05249f030429b19bbeec7868512795d0034b
BLAKE2b-256 checksum
How to use checksums
1ae78c31d87d8e406f1627ca5026e84023444d54fdff1f02554d27f2a24e8e92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.13

Release files / auto_depreciation-3.1.1-py3-none-any.whl

Download URL auto_depreciation-3.1.1-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5840a30a5fa7939b30b11a8c7397eb6f2d31b2e5b214638dd64760e6c808d956
BLAKE2b-256 checksum
How to use checksums
0eb372514dfd241f48766b88981a9f2faa527e11a402fbd42ba3bf05b2615c8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.13

Release history Release notifications | RSS feed

This release

3.1.1 This release

2 release files

3.1.0

2 release files

3.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page