Skip to content

Commit d860bd9

Browse files
committed
Documentation Update
1 parent 12dd7f6 commit d860bd9

File tree

6 files changed

+80
-50
lines changed

6 files changed

+80
-50
lines changed

django_ledger/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
logger.info(f'Django Ledger GraphQL Enabled: {DJANGO_LEDGER_GRAPHQL_SUPPORT_ENABLED}')
3333

34-
DJANGO_LEDGER_USE_CLOSING_ENTRIES = getattr(settings, 'DJANGO_LEDGER_USE_CLOSING_ENTRIES', False)
34+
DJANGO_LEDGER_USE_CLOSING_ENTRIES = getattr(settings, 'DJANGO_LEDGER_USE_CLOSING_ENTRIES', True)
3535
DJANGO_LEDGER_DEFAULT_CLOSING_ENTRY_CACHE_TIMEOUT = getattr(settings,
3636
'DJANGO_LEDGER_DEFAULT_CLOSING_ENTRY_CACHE_TIMEOUT', 3600)
3737
DJANGO_LEDGER_LOGIN_URL = getattr(settings, 'DJANGO_LEDGER_LOGIN_URL', settings.LOGIN_URL)

docs/source/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ Django Ledger - The Django Book Keeping Engine.
1313
:maxdepth: 2
1414
:caption: Contents:
1515

16+
./README.md
1617
./quickstart
18+
./io
1719
./models
1820

1921

22+
2023
Indices and tables
2124
==================
2225

docs/source/io.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
IO Engine
2+
=========
3+
4+
IO MixIn
5+
--------
6+
.. automodule:: django_ledger.io.io_mixin
7+
:members:

docs/source/quickstart.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ Quickstart
22
==========
33

44
.. toctree::
5-
./README.md
65
./quickstart_notebook.md

docs/source/quickstart_notebook.md

Lines changed: 47 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,26 @@ from django_ledger.io import roles
3535

3636
```python
3737
# change this to your preferred django username...
38-
MY_USERNAME = 'elarroba'
38+
MY_USERNAME = 'ceo_user'
39+
MY_PASSWORD = 'NeverUseMe|VeryInsecure!'
3940
UserModel = get_user_model()
40-
user_model = UserModel.objects.get(username__exact=MY_USERNAME)
41+
42+
try:
43+
user_model = UserModel.objects.get(username__exact=MY_USERNAME)
44+
except:
45+
user_model = UserModel.objects.create(username=MY_USERNAME, password=MY_PASSWORD)
4146
```
4247

4348
# Create an Entity Model
4449

4550

4651
```python
47-
entity_model = EntityModel(
52+
entity_model = EntityModel.create_entity(
4853
name='One Big Company, LLC',
4954
admin=user_model,
50-
accrual_method=True
55+
use_accrual_method=True,
56+
fy_start_month=1
5157
)
52-
entity_model.clean()
53-
entity_model = EntityModel.add_root(instance=entity_model)
5458
```
5559

5660

@@ -70,9 +74,10 @@ entity_model.has_default_coa()
7074

7175
```python
7276
default_coa_model = entity_model.create_chart_of_accounts(
73-
assign_as_default=True,
74-
commit=True,
75-
coa_name='My QuickStart CoA')
77+
assign_as_default=True,
78+
commit=True,
79+
coa_name='My QuickStart CoA'
80+
)
7681
```
7782

7883

@@ -113,9 +118,10 @@ default_coa_model = entity_model.get_default_coa()
113118

114119
```python
115120
another_coa_model = entity_model.create_chart_of_accounts(
116-
assign_as_default=False,
117-
commit=True,
118-
coa_name='My Legacy Chart of Accounts')
121+
assign_as_default=False,
122+
commit=True,
123+
coa_name='My Legacy Chart of Accounts'
124+
)
119125
```
120126

121127
# Accounts
@@ -128,9 +134,10 @@ coa_qs, coa_map = entity_model.get_all_coa_accounts()
128134
pd.DataFrame(coa_map[default_coa_model].values())
129135
```
130136

137+
### New CoA does not have any accounts yet...
138+
131139

132140
```python
133-
# new CoA does not have any accounts yet...
134141
pd.DataFrame(coa_map[another_coa_model].values())
135142
```
136143

@@ -166,13 +173,6 @@ coa_accounts_by_coa_slug_qs = entity_model.get_coa_accounts(coa_model=default_co
166173
pd.DataFrame(coa_accounts_by_coa_slug_qs.values())
167174
```
168175

169-
170-
```python
171-
# coa_accounts_by_codes_qs = entity_model.get_accounts_with_codes(code_list=['ABC'],
172-
# coa_model=another_coa_model)
173-
# pd.DataFrame(coa_accounts_by_codes_qs.values())
174-
```
175-
176176
## Get Accounts With Codes and CoA Model
177177

178178

@@ -188,7 +188,7 @@ pd.DataFrame(coa_accounts_by_codes_qs.values())
188188
coa_model, account_model = entity_model.create_account(
189189
coa_model=another_coa_model,
190190
account_model_kwargs={
191-
'code': f'1{str(randint(10000,99999))}ABC',
191+
'code': f'1{str(randint(10000, 99999))}ABC',
192192
'role': roles.ASSET_CA_INVENTORY,
193193
'name': 'A cool account created from the EntityModel API!',
194194
'balance_type': roles.DEBIT,
@@ -203,8 +203,8 @@ account_model
203203

204204

205205
```python
206-
given_coa_accounts_qs = entity_model.get_coa_accounts(coa_model=another_coa_model)
207-
pd.DataFrame(given_coa_accounts_qs.values())
206+
another_coa_accounts_qs = entity_model.get_coa_accounts(coa_model=another_coa_model)
207+
pd.DataFrame(another_coa_accounts_qs.values())
208208
```
209209

210210
# Customers
@@ -269,7 +269,7 @@ invoice_model = entity_model.create_invoice(
269269

270270

271271
```python
272-
# invoice_model.
272+
invoice_model
273273
```
274274

275275
## Add Items to Invoices
@@ -278,6 +278,7 @@ invoice_model = entity_model.create_invoice(
278278
```python
279279
invoices_item_models = invoice_model.get_item_model_qs()
280280

281+
# K= number of items...
281282
K = 6
282283

283284
invoice_itemtxs = {
@@ -320,6 +321,11 @@ bill_model = entity_model.create_bill(
320321
)
321322
```
322323

324+
325+
```python
326+
bill_model
327+
```
328+
323329
## Add Items to Bills
324330

325331

@@ -410,7 +416,7 @@ pd.DataFrame(estimates_qs.values())
410416

411417
```python
412418
estimate_model = entity_model.create_estimate(
413-
estimate_title='A quote for new potential customer!',
419+
estimate_title='A quote for new potential customer!',
414420
customer_model='C-0000000009',
415421
contract_terms=EstimateModel.CONTRACT_TERMS_FIXED
416422
)
@@ -619,11 +625,13 @@ inventory_model.is_inventory()
619625

620626
```python
621627
bs_report = entity_model.get_balance_sheet_statement(
622-
to_date=date(2022,12,31),
628+
to_date=date(2022, 12, 31),
623629
save_pdf=True,
630+
filepath='./'
624631
)
625632
# save_pdf=True saves the PDF report in the project's BASE_DIR.
626633
# filename and filepath may also be specified...
634+
# will raise not implemented error if PDF support is not enabled...
627635
```
628636

629637
### Balance Sheet Statement Raw Data
@@ -638,12 +646,14 @@ bs_report.get_report_data()
638646

639647
```python
640648
ic_report = entity_model.get_income_statement(
641-
from_date=date(2022,1,1),
642-
to_date=date(2022,12,31),
643-
save_pdf=True
649+
from_date=date(2022, 1, 1),
650+
to_date=date(2022, 12, 31),
651+
save_pdf=True,
652+
filepath='./'
644653
)
645654
# save_pdf=True saves the PDF report in the project's BASE_DIR.
646655
# filename and filepath may also be specified...
656+
# will raise not implemented error if PDF support is not enabled...
647657
```
648658

649659
### Income Statement Raw Data
@@ -658,9 +668,10 @@ ic_report.get_report_data()
658668

659669
```python
660670
cf_report = entity_model.get_cash_flow_statement(
661-
from_date=date(2022,1,1),
662-
to_date=date(2022,12,31),
663-
save_pdf=True
671+
from_date=date(2022, 1, 1),
672+
to_date=date(2022, 12, 31),
673+
save_pdf=True,
674+
filepath='./'
664675
)
665676
# save_pdf=True saves the PDF report in the project's BASE_DIR.
666677
# filename and filepath may also be specified...
@@ -679,9 +690,10 @@ cf_report.get_report_data()
679690
```python
680691
reports = entity_model.get_financial_statements(
681692
user_model=user_model,
682-
from_date=date(2022,1,1),
683-
to_date=date(2022,12,31),
684-
save_pdf=True
693+
from_date=date(2022, 1, 1),
694+
to_date=date(2022, 12, 31),
695+
save_pdf=True,
696+
filepath='./'
685697
)
686698
# save_pdf=True saves the PDF report in the project's BASE_DIR.
687699
# filename and filepath may also be specified...

notebooks/QuickStart Notebook.ipynb

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -270,12 +270,15 @@
270270
},
271271
{
272272
"cell_type": "markdown",
273+
"metadata": {
274+
"collapsed": false,
275+
"jupyter": {
276+
"outputs_hidden": false
277+
}
278+
},
273279
"source": [
274280
"### New CoA does not have any accounts yet..."
275-
],
276-
"metadata": {
277-
"collapsed": false
278-
}
281+
]
279282
},
280283
{
281284
"cell_type": "code",
@@ -678,13 +681,16 @@
678681
{
679682
"cell_type": "code",
680683
"execution_count": null,
684+
"metadata": {
685+
"collapsed": false,
686+
"jupyter": {
687+
"outputs_hidden": false
688+
}
689+
},
681690
"outputs": [],
682691
"source": [
683692
"bill_model"
684-
],
685-
"metadata": {
686-
"collapsed": false
687-
}
693+
]
688694
},
689695
{
690696
"cell_type": "markdown",
@@ -1450,11 +1456,14 @@
14501456
{
14511457
"cell_type": "code",
14521458
"execution_count": null,
1453-
"outputs": [],
1454-
"source": [],
14551459
"metadata": {
1456-
"collapsed": false
1457-
}
1460+
"collapsed": false,
1461+
"jupyter": {
1462+
"outputs_hidden": false
1463+
}
1464+
},
1465+
"outputs": [],
1466+
"source": []
14581467
}
14591468
],
14601469
"metadata": {
@@ -1473,7 +1482,7 @@
14731482
"name": "python",
14741483
"nbconvert_exporter": "python",
14751484
"pygments_lexer": "ipython3",
1476-
"version": "3.11.3"
1485+
"version": "3.11.6"
14771486
}
14781487
},
14791488
"nbformat": 4,

0 commit comments

Comments
 (0)