austax: Implement editing CGT cost adjustments
This commit is contained in:
parent
0df8ccfaa1
commit
9ad5b7642e
@ -36,6 +36,7 @@
|
|||||||
<th>Adjustment date</th>
|
<th>Adjustment date</th>
|
||||||
<th>Description</th>
|
<th>Description</th>
|
||||||
<th class="text-end">Cost adjustment </th>
|
<th class="text-end">Cost adjustment </th>
|
||||||
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -49,6 +50,7 @@
|
|||||||
<td>{{ cgt_adjustment.dt.strftime('%Y-%m-%d') }}</td>
|
<td>{{ cgt_adjustment.dt.strftime('%Y-%m-%d') }}</td>
|
||||||
<td>{{ cgt_adjustment.description }}</td>
|
<td>{{ cgt_adjustment.description }}</td>
|
||||||
<td class="text-end">{{ cgt_adjustment.cost_adjustment_amount().format_accounting() }}</td>
|
<td class="text-end">{{ cgt_adjustment.cost_adjustment_amount().format_accounting() }}</td>
|
||||||
|
<td><a href="/tax/cgt-adjustments/edit?id={{ cgt_adjustment.id }}"><i class="bi bi-pencil"></i></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -51,6 +51,26 @@ def cgt_adjustment_new():
|
|||||||
|
|
||||||
return redirect('/tax/cgt-adjustments')
|
return redirect('/tax/cgt-adjustments')
|
||||||
|
|
||||||
|
@app.route('/tax/cgt-adjustments/edit', methods=['GET', 'POST'])
|
||||||
|
def cgt_adjustment_edit():
|
||||||
|
if request.method == 'GET':
|
||||||
|
return render_plugin_template('austax', 'cgt_adjustments_edit.html', adjustment=db.session.get(CGTCostAdjustment, request.args['id']))
|
||||||
|
|
||||||
|
asset = Amount.parse(request.form['asset'])
|
||||||
|
adjustment = db.session.get(CGTCostAdjustment, request.args['id'])
|
||||||
|
adjustment.quantity = asset.quantity
|
||||||
|
adjustment.commodity = asset.commodity
|
||||||
|
adjustment.account = request.form['account']
|
||||||
|
adjustment.acquisition_date = datetime.strptime(request.form['acquisition_date'], '%Y-%m-%d')
|
||||||
|
adjustment.dt = datetime.strptime(request.form['dt'], '%Y-%m-%d')
|
||||||
|
adjustment.description = request.form['description']
|
||||||
|
adjustment.cost_adjustment = Amount.parse(request.form['cost_adjustment']).quantity
|
||||||
|
|
||||||
|
db.session.add(adjustment)
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
|
return redirect('/tax/cgt-adjustments')
|
||||||
|
|
||||||
@app.route('/tax/cgt-assets')
|
@app.route('/tax/cgt-assets')
|
||||||
def cgt_assets():
|
def cgt_assets():
|
||||||
# Find all CGT asset accounts
|
# Find all CGT asset accounts
|
||||||
|
Loading…
Reference in New Issue
Block a user