diff --git a/austax/__init__.py b/austax/__init__.py
index df24417..4a6e337 100644
--- a/austax/__init__.py
+++ b/austax/__init__.py
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
-from flask import render_template
+from flask import render_template, url_for
from drcr.models import AccountConfiguration, Posting, Transaction, TrialBalancer
from drcr.database import db
@@ -24,9 +24,9 @@ from .reports import eofy_date, tax_summary_report
from . import views
def plugin_init():
- drcr.plugins.data_sources.append(('/tax/cgt-adjustments', 'CGT adjustments'))
- drcr.plugins.advanced_reports.append(('/tax/cgt-assets', 'CGT assets'))
- drcr.plugins.advanced_reports.append(('/tax/summary', 'Tax summary'))
+ drcr.plugins.data_sources.append(('cgt_adjustments', 'CGT adjustments'))
+ drcr.plugins.advanced_reports.append(('cgt_assets', 'CGT assets'))
+ drcr.plugins.advanced_reports.append(('tax_summary', 'Tax summary'))
drcr.plugins.account_kinds.append(('austax.income1', 'Salary or wages (1)'))
drcr.plugins.account_kinds.append(('austax.income5', 'Australian Government allowances and payments (5)'))
diff --git a/austax/templates/cgt_adjustments.html b/austax/templates/cgt_adjustments.html
index 5c6f5c5..3015a55 100644
--- a/austax/templates/cgt_adjustments.html
+++ b/austax/templates/cgt_adjustments.html
@@ -22,8 +22,8 @@
CGT adjustments
@@ -51,7 +51,7 @@
{{ cgt_adjustment.dt.strftime('%Y-%m-%d') }}
{{ cgt_adjustment.description }}
{{ cgt_adjustment.cost_adjustment_amount().format_accounting() }}
-
+
{% endfor %}
diff --git a/austax/templates/cgt_assets.html b/austax/templates/cgt_assets.html
index b6bd644..5b999dc 100644
--- a/austax/templates/cgt_assets.html
+++ b/austax/templates/cgt_assets.html
@@ -50,14 +50,14 @@
{% for asset in assets %}
- {{ asset.account }}
+ {{ asset.account }}
{{ asset.commodity_name() }}
{{ asset.format('hide') }}
{{ asset.acquisition_date.strftime('%Y-%m-%d') }}
{{ asset.as_cost().format() }}
- {{ asset.cost_adjustment().format_accounting(link="/tax/cgt-adjustments?account={}&commodity={}&quantity={}&acquisition_date={:%Y-%m-%d}".format(asset.account, asset.commodity, asset.quantity, asset.acquisition_date)) if asset.cost_adjustments }}
+ {{ asset.cost_adjustment().format_accounting(link=url_for('cgt_adjustments', account=asset.account, commodity=asset.commodity, quantity=asset.quantity, acquisition_date=asset.acquisition_date.strftime('%Y-%m-%d'))) if asset.cost_adjustments }}
{# TODO #}
-
+
{{ asset.disposal_date.strftime('%Y-%m-%d') if asset.disposal_date else '' }}
{{ asset.disposal_value.format() if asset.disposal_value else '' }}
{% if asset.disposal_date %}{{ asset.gain().format_accounting() }}{% endif %}
diff --git a/austax/views.py b/austax/views.py
index 94f60d4..58b6138 100644
--- a/austax/views.py
+++ b/austax/views.py
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
-from flask import redirect, render_template, request
+from flask import redirect, render_template, request, url_for
from drcr.models import AccountConfiguration, Amount, Posting, Transaction
from drcr.database import db
@@ -60,7 +60,7 @@ def cgt_adjustment_new():
db.session.add(adjustment)
db.session.commit()
- return redirect('/tax/cgt-adjustments')
+ return redirect(url_for('cgt_adjustments'))
@app.route('/tax/cgt-adjustments/edit', methods=['GET', 'POST'])
def cgt_adjustment_edit():
@@ -80,7 +80,7 @@ def cgt_adjustment_edit():
db.session.add(adjustment)
db.session.commit()
- return redirect('/tax/cgt-adjustments')
+ return redirect(url_for('cgt_adjustments'))
@app.route('/tax/cgt-adjustments/multi-new', methods=['GET', 'POST'])
def cgt_adjustment_multinew():
@@ -166,7 +166,7 @@ def cgt_adjustment_multinew():
db.session.commit()
- return redirect('/tax/cgt-adjustments')
+ return redirect(url_for('cgt_adjustments'))
@app.route('/tax/cgt-assets')
def cgt_assets():
diff --git a/drcr/journal/views.py b/drcr/journal/views.py
index e666c35..13a066f 100644
--- a/drcr/journal/views.py
+++ b/drcr/journal/views.py
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
-from flask import abort, redirect, render_template, request
+from flask import abort, redirect, render_template, request, url_for
from .. import AMOUNT_DPS
from ..database import db
@@ -31,7 +31,7 @@ def journal():
return render_template(
'journal/journal.html',
- commodity_detail=request.args.get('commodity-detail', '0') == '1',
+ commodity_detail=request.args.get('commodity_detail', '0') == '1',
transactions=transactions
)
@@ -64,7 +64,7 @@ def journal_new_transaction():
db.session.add(transaction)
db.session.commit()
- return redirect('/journal')
+ return redirect(url_for('journal'))
@app.route('/journal/edit-transaction', methods=['GET', 'POST'])
def journal_edit_transaction():
@@ -109,7 +109,7 @@ def journal_edit_transaction():
db.session.commit()
- return redirect('/journal')
+ return redirect(url_for('journal'))
@app.route('/balance-assertions')
def balance_assertions():
@@ -151,7 +151,7 @@ def balance_assertions_new():
db.session.add(assertion)
db.session.commit()
- return redirect('/balance-assertions')
+ return redirect(url_for('balance_assertions'))
@app.route('/balance-assertions/edit', methods=['GET', 'POST'])
def balance_assertions_edit():
@@ -174,4 +174,4 @@ def balance_assertions_edit():
db.session.commit()
- return redirect('/balance-assertions')
+ return redirect(url_for('balance_assertions'))
diff --git a/drcr/plugins.py b/drcr/plugins.py
index a530c78..caed990 100644
--- a/drcr/plugins.py
+++ b/drcr/plugins.py
@@ -21,8 +21,8 @@ from .webapp import app
import importlib
-data_sources = [] # list of tuplet (url, label)
-advanced_reports = [] # list of tuplet (url, label)
+data_sources = [] # list of tuplet (view name, label)
+advanced_reports = [] # list of tuplet (view name, label)
account_kinds = [
# list of tuplet (id, label)
diff --git a/drcr/reports.py b/drcr/reports.py
index caa1602..300da65 100644
--- a/drcr/reports.py
+++ b/drcr/reports.py
@@ -14,6 +14,8 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
+from flask import url_for
+
from .models import AccountConfiguration, Amount, TrialBalancer
from .webapp import all_transactions
@@ -123,7 +125,7 @@ def entries_for_kind(account_configurations, accounts, kind, neg=False, floor=0)
amount = -amount
if floor:
amount.quantity = (amount.quantity // floor) * floor
- entries.append(Entry(text=account_name, amount=amount, link='/account-transactions?account=' + account_name))
+ entries.append(Entry(text=account_name, amount=amount, link=url_for('account_transactions', account=account_name)))
return entries
def balance_sheet_report():
@@ -156,7 +158,7 @@ def balance_sheet_report():
Calculated(
'Current year surplus (deficit)',
lambda _: income_statement_report().by_id('net_surplus').amount,
- link='/income-statement'
+ link=url_for('income_statement')
),
Subtotal('Total equity', bordered=True)
]
diff --git a/drcr/statements/views.py b/drcr/statements/views.py
index 7171725..344d5e7 100644
--- a/drcr/statements/views.py
+++ b/drcr/statements/views.py
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
-from flask import abort, redirect, render_template, request
+from flask import abort, redirect, render_template, request, url_for
from .. import AMOUNT_DPS
from ..database import db
@@ -94,7 +94,7 @@ def statement_line_reconcile_transfer():
db.session.add(transaction)
db.session.commit()
- return redirect('/statement-lines')
+ return redirect(url_for('statement_lines'))
@app.route('/statement-lines/import', methods=['GET', 'POST'])
def statement_lines_import():
@@ -123,4 +123,4 @@ def statement_lines_import():
db.session.add(statement_line)
db.session.commit()
- return redirect('/statement-lines')
+ return redirect(url_for('statement_lines'))
diff --git a/drcr/templates/base.html b/drcr/templates/base.html
index ba0d01d..1db8b46 100644
--- a/drcr/templates/base.html
+++ b/drcr/templates/base.html
@@ -35,12 +35,12 @@
{% block body %}
diff --git a/drcr/templates/chart_of_accounts.html b/drcr/templates/chart_of_accounts.html
index 356f031..f3cb5f8 100644
--- a/drcr/templates/chart_of_accounts.html
+++ b/drcr/templates/chart_of_accounts.html
@@ -35,7 +35,7 @@
- Add kind
+ Add kind
diff --git a/drcr/templates/general_ledger.html b/drcr/templates/general_ledger.html
index edcdbab..a31f6c8 100644
--- a/drcr/templates/general_ledger.html
+++ b/drcr/templates/general_ledger.html
@@ -23,9 +23,9 @@
diff --git a/drcr/templates/index.html b/drcr/templates/index.html
index 68ba10c..34303e4 100644
--- a/drcr/templates/index.html
+++ b/drcr/templates/index.html
@@ -21,27 +21,27 @@
{% block content %}
Data sources
General reports
Advanced reports
{% endblock %}
diff --git a/drcr/templates/journal/balance_assertions.html b/drcr/templates/journal/balance_assertions.html
index bb747a0..cf9986b 100644
--- a/drcr/templates/journal/balance_assertions.html
+++ b/drcr/templates/journal/balance_assertions.html
@@ -22,7 +22,7 @@
Balance assertions
@@ -46,7 +46,7 @@
{{ (assertion.balance()|abs).format() }}
{{ 'Dr' if assertion.quantity >= 0 else 'Cr' }}
{% if assertion_status[assertion] %} {% else %} {% endif %}
-
+
{% endfor %}
diff --git a/drcr/templates/journal/journal.html b/drcr/templates/journal/journal.html
index 84b9a49..57d74eb 100644
--- a/drcr/templates/journal/journal.html
+++ b/drcr/templates/journal/journal.html
@@ -22,11 +22,11 @@
Journal
@@ -43,7 +43,7 @@
{% for transaction in transactions %}
{{ transaction.dt.strftime('%Y-%m-%d') }}
- {{ transaction.description }}
+ {{ transaction.description }}
diff --git a/drcr/templates/statements/statement_lines.html b/drcr/templates/statements/statement_lines.html
index 9d92d8f..f4f55b4 100644
--- a/drcr/templates/statements/statement_lines.html
+++ b/drcr/templates/statements/statement_lines.html
@@ -25,7 +25,7 @@
{#
Reconcile selected as transfer #}